using System;
using System.IO;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using AMS.Profile;
using QuartzTypeLib;

namespace etbTOEIC
{
	/// <summary>
	/// Summary description for FormMain.
	/// </summary>
	public class FormMain : System.Windows.Forms.Form
	{

		#region /* Member Variables */
		public bool IsModifyTestActive = true;
		public HTMLGenerator webContent = new HTMLGenerator ();
		public bool IsModifiedTest = false;
		public bool IsUpdatedView = false;
		public int []nNumberOfQuesDef = new int[7];
		string ExamCode = "" , Direction1A = "" , Direction1B = "" , Direction1C = "" , Direction1D = "" , Direction2A = "" , Direction2B = "" , Direction3 = "" , TheEnd1A = "" , TheEnd1B = "" , TheEnd1C = "" , TheEnd1D = "" , TheEnd2A = "" , TheEnd2B = "" , TheEnd3 = "";
		DateTime  DateCreate = DateTime.Today;
		
		// media 
		private const int WM_APP = 0x8000;
		private const int WM_GRAPHNOTIFY = WM_APP + 1;
		private const int EC_COMPLETE = 0x01;
		private const int WS_CHILD = 0x40000000;
		private const int WS_CLIPCHILDREN = 0x2000000;

		private FilgraphManager m_objFilterGraph = null;
		private IBasicAudio m_objBasicAudio = null;
		private IVideoWindow m_objVideoWindow = null;
		private IMediaEvent m_objMediaEvent = null;
		private IMediaEventEx m_objMediaEventEx = null;
		private IMediaPosition m_objMediaPosition = null;
		private IMediaControl m_objMediaControl = null;
		#endregion

		#region /* Control on Form */
		private TD.SandDock.SandDockManager sandDockManager1;
		private TD.SandBar.SandBarManager sandBarManager1;
		private TD.SandBar.SandBarManager sandBarManager2;
		private TD.SandBar.ToolBarContainer leftSandBarDock;
		private TD.SandBar.ToolBarContainer rightSandBarDock;
		private TD.SandBar.ToolBarContainer bottomSandBarDock;
		private TD.SandBar.ToolBarContainer topSandBarDock;
		private TD.SandBar.MenuBar menuBar1;
		private TD.SandBar.MenuBarItem menuBarItem1;
		private TD.SandBar.MenuBarItem menuBarItem2;
		private TD.SandBar.MenuBarItem menuBarItem4;
		private TD.SandBar.MenuBarItem menuBarItem5;
		private TD.SandDock.SandDockManager sandDockManager2;
		private TD.SandDock.DockContainer rightSandDock;
		private TD.SandDock.DockContainer bottomSandDock;
		private TD.SandDock.DockContainer topSandDock;
		private TD.SandDock.DocumentContainer documentContainer1;
		private System.Windows.Forms.StatusBar statusBar1;
		private System.Windows.Forms.StatusBarPanel statusBarPanel1;
		private System.Windows.Forms.StatusBarPanel statusBarPanel2;
		private System.Windows.Forms.StatusBarPanel statusBarPanel3;
		private System.Data.OleDb.OleDbConnection oleDbConnection1;
		private System.Windows.Forms.TreeView treeViewQuestion;
		private TD.SandDock.DockContainer leftSandDock;
		private TD.SandBar.ButtonItem buttonItemEInfo;
		private TD.SandBar.ButtonItem buttonItemETest;
		private TD.SandBar.ButtonItem buttonItemEAns;
		private TD.SandBar.ButtonItem buttonItemETape;
		private TD.SandBar.ButtonItem buttonItemESound;
		private TD.SandBar.ButtonItem buttonItemEBuild;
		private TD.SandBar.ToolBar toolBarTopicQues;
		private TD.SandBar.ButtonItem buttonItemTAdd;
		private TD.SandBar.ButtonItem buttonItemTDel;
		private TD.SandBar.ButtonItem buttonItemTEdit;
		private TD.SandBar.ButtonItem buttonItemTPlay;
		private TD.SandBar.ButtonItem buttonItemQAdd;
		private TD.SandBar.ButtonItem buttonItemQDel;
		private TD.SandBar.ButtonItem buttonItemQEdit;
		private TD.SandBar.ButtonItem buttonItemQPlay;
		private TD.SandBar.ToolBar toolBarStandard;
		private TD.SandBar.ButtonItem buttonItemExamTestNoModify;
		private TD.SandBar.ButtonItem buttonItemExamTestCanModify;
		private System.Windows.Forms.Panel panel1;
		private AxSHDocVw.AxWebBrowser axWebBrowser1;
		private TD.SandBar.ButtonItem buttonItemFileNew;
		private TD.SandBar.ButtonItem buttonItemFileOpen;
		private TD.SandBar.ButtonItem buttonItemFileSave;
		private TD.SandBar.MenuButtonItem menuButtonItemFileNew;
		private TD.SandBar.MenuButtonItem menuButtonItemFileOpen;
		private TD.SandBar.MenuButtonItem menuButtonItemFileSave;
		private TD.SandBar.MenuButtonItem menuButtonItemFileExit;
		private TD.SandBar.MenuButtonItem menuButtonItemFilePreview;
		private TD.SandBar.ButtonItem buttonItemFilePreview;
		private TD.SandBar.MenuButtonItem menuButtonItemFileSaveAs;
		private TD.SandBar.MenuButtonItem menuButtonItemFileProperties;
		private System.Windows.Forms.StatusBar statusBar2;
		private System.Windows.Forms.StatusBarPanel statusBarPanel4;
		private System.Windows.Forms.StatusBarPanel statusBarPanel5;
		private System.Windows.Forms.StatusBarPanel statusBarPanel6;
		private TD.SandBar.MenuBarItem menuBarItemView;
		private TD.SandBar.MenuButtonItem menuButtonItemStandardToolbar;
		private TD.SandBar.MenuButtonItem menuButtonItemQuestionToolbar;
		private TD.SandBar.MenuButtonItem menuButtonItemExamTestToolbar;
		private TD.SandBar.MenuButtonItem menuButtonItemDetailInfomations;
		private TD.SandBar.MenuButtonItem menuButtonItemQuestionsTreeView;
		private TD.SandBar.MenuButtonItem menuButtonItemExamTestTreeView;
		private TD.SandBar.MenuButtonItem menuButtonItemExamTestDetail;
		private TD.SandDock.DockControl dockControlDetailInfo;
		private TD.SandBar.MenuButtonItem menuButtonItemAbout;
		private TD.SandBar.MenuButtonItem menuButtonItemHelp;
		private TD.SandBar.ButtonItem buttonItemHelp;
		private TD.SandBar.ToolBar toolBarExamTest;
		private TD.SandDock.DockControl dockControlExamTestTree;
		private TD.SandDock.DockControl dockControlQuestionTree;
		private TD.SandDock.DockControl dockControlExamTest;
		private System.Windows.Forms.TreeView treeViewExamTest;
		private System.Windows.Forms.StatusBar statusBar3;
		private System.Windows.Forms.StatusBarPanel statusBarPanel7;
		private System.Windows.Forms.StatusBarPanel statusBarPanel8;
		private System.Windows.Forms.StatusBarPanel statusBarPanel9;
		private TD.SandBar.MenuButtonItem menuButtonItemETQuestion;
		private TD.SandBar.MenuButtonItem menuButtonItemETAnswer;
		private TD.SandBar.MenuButtonItem menuButtonItemETTape;
		private TD.SandBar.MenuButtonItem menuButtonItem2;
		private System.Windows.Forms.Panel panel2;
		private AxSHDocVw.AxWebBrowser axWebBrowser2;
		private TD.SandBar.ButtonItem buttonItemMoveUp;
		private TD.SandBar.ButtonItem buttonItemMoveDown;
		private TD.SandBar.MenuBarItem menuBarItemTest;
		private TD.SandBar.MenuButtonItem menuButtonItemModifyExamTest;
		private TD.SandBar.MenuButtonItem menuButtonItemMoveUp;
		private TD.SandBar.MenuButtonItem menuButtonItemMoveDown;
		private TD.SandBar.MenuButtonItem menuButtonItemRemoveItem;
		private TD.SandBar.ButtonItem buttonItemRemoveItem;
		private TD.SandBar.ButtonItem buttonItemExamTestRefresh;
		#endregion
		private TD.SandBar.MenuButtonItem menuButtonItemChangePass;
		private TD.SandBar.MenuBarItem menuBarItemManage;
		private TD.SandBar.MenuButtonItem menuButtonItemConfig;
		private TD.SandBar.MenuButtonItem menuButtonItemAddBook;
		private TD.SandBar.MenuButtonItem menuButtonItemEditBook;
		private TD.SandBar.MenuButtonItem menuButtonItemDelBook;
		private TD.SandBar.MenuButtonItem menuButtonItemDelTest;
		private TD.SandBar.MenuButtonItem menuButtonItemRefresh;
		private TD.SandBar.MenuButtonItem menuButtonItemAddQues;
		private TD.SandBar.MenuButtonItem menuButtonItemEditQues;
		private TD.SandBar.MenuButtonItem menuButtonItemDelQues;
		private TD.SandBar.MenuButtonItem menuButtonItemAddTop;
		private TD.SandBar.MenuButtonItem menuButtonItemEditTop;
		private TD.SandBar.MenuButtonItem menuButtonItemDelTop;
		private TD.SandBar.MenuButtonItem menuButtonItem3;

		/// <summary>
		/// Required designer variable.
		/// </summary>
		private System.ComponentModel.Container components = null;

		public FormMain()
		{
			//
			// Required for Windows Form Designer support
			//
			InitializeComponent();

			//
			// TODO: Add any constructor code after InitializeComponent call
			//
		}

		/// <summary>
		/// Clean up any resources being used.
		/// </summary>
		protected override void Dispose( bool disposing )
		{
			if( disposing )
			{
				if (components != null) 
				{
					components.Dispose();
				}
			}
			base.Dispose( disposing );
		}

		#region Windows Form Designer generated code
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{
			System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(FormMain));
			this.sandDockManager1 = new TD.SandDock.SandDockManager();
			this.sandBarManager1 = new TD.SandBar.SandBarManager();
			this.sandBarManager2 = new TD.SandBar.SandBarManager();
			this.leftSandBarDock = new TD.SandBar.ToolBarContainer();
			this.rightSandBarDock = new TD.SandBar.ToolBarContainer();
			this.bottomSandBarDock = new TD.SandBar.ToolBarContainer();
			this.topSandBarDock = new TD.SandBar.ToolBarContainer();
			this.toolBarExamTest = new TD.SandBar.ToolBar();
			this.buttonItemExamTestNoModify = new TD.SandBar.ButtonItem();
			this.buttonItemExamTestCanModify = new TD.SandBar.ButtonItem();
			this.buttonItemExamTestRefresh = new TD.SandBar.ButtonItem();
			this.buttonItemMoveUp = new TD.SandBar.ButtonItem();
			this.buttonItemMoveDown = new TD.SandBar.ButtonItem();
			this.buttonItemRemoveItem = new TD.SandBar.ButtonItem();
			this.buttonItemEInfo = new TD.SandBar.ButtonItem();
			this.buttonItemETest = new TD.SandBar.ButtonItem();
			this.buttonItemETape = new TD.SandBar.ButtonItem();
			this.buttonItemEAns = new TD.SandBar.ButtonItem();
			this.buttonItemEBuild = new TD.SandBar.ButtonItem();
			this.buttonItemESound = new TD.SandBar.ButtonItem();
			this.toolBarTopicQues = new TD.SandBar.ToolBar();
			this.buttonItemTAdd = new TD.SandBar.ButtonItem();
			this.buttonItemTDel = new TD.SandBar.ButtonItem();
			this.buttonItemTEdit = new TD.SandBar.ButtonItem();
			this.buttonItemTPlay = new TD.SandBar.ButtonItem();
			this.buttonItemQAdd = new TD.SandBar.ButtonItem();
			this.buttonItemQDel = new TD.SandBar.ButtonItem();
			this.buttonItemQEdit = new TD.SandBar.ButtonItem();
			this.buttonItemQPlay = new TD.SandBar.ButtonItem();
			this.menuBar1 = new TD.SandBar.MenuBar();
			this.menuBarItem1 = new TD.SandBar.MenuBarItem();
			this.menuButtonItemFileNew = new TD.SandBar.MenuButtonItem();
			this.menuButtonItemFileOpen = new TD.SandBar.MenuButtonItem();
			this.menuButtonItemFileSave = new TD.SandBar.MenuButtonItem();
			this.menuButtonItemFileSaveAs = new TD.SandBar.MenuButtonItem();
			this.menuButtonItemFilePreview = new TD.SandBar.MenuButtonItem();
			this.menuButtonItemChangePass = new TD.SandBar.MenuButtonItem();
			this.menuButtonItemFileExit = new TD.SandBar.MenuButtonItem();
			this.menuBarItem2 = new TD.SandBar.MenuBarItem();
			this.menuButtonItemAddQues = new TD.SandBar.MenuButtonItem();
			this.menuButtonItemEditQues = new TD.SandBar.MenuButtonItem();
			this.menuButtonItemDelQues = new TD.SandBar.MenuButtonItem();
			this.menuButtonItemAddTop = new TD.SandBar.MenuButtonItem();
			this.menuButtonItemEditTop = new TD.SandBar.MenuButtonItem();
			this.menuButtonItemDelTop = new TD.SandBar.MenuButtonItem();
			this.menuBarItemView = new TD.SandBar.MenuBarItem();
			this.menuButtonItemStandardToolbar = new TD.SandBar.MenuButtonItem();
			this.menuButtonItemQuestionToolbar = new TD.SandBar.MenuButtonItem();
			this.menuButtonItemExamTestToolbar = new TD.SandBar.MenuButtonItem();
			this.menuButtonItemQuestionsTreeView = new TD.SandBar.MenuButtonItem();
			this.menuButtonItemExamTestTreeView = new TD.SandBar.MenuButtonItem();
			this.menuButtonItemDetailInfomations = new TD.SandBar.MenuButtonItem();
			this.menuButtonItemExamTestDetail = new TD.SandBar.MenuButtonItem();
			this.menuBarItemTest = new TD.SandBar.MenuBarItem();
			this.menuButtonItemModifyExamTest = new TD.SandBar.MenuButtonItem();
			this.menuButtonItemMoveUp = new TD.SandBar.MenuButtonItem();
			this.menuButtonItemMoveDown = new TD.SandBar.MenuButtonItem();
			this.menuButtonItemRemoveItem = new TD.SandBar.MenuButtonItem();
			this.menuButtonItemFileProperties = new TD.SandBar.MenuButtonItem();
			this.menuButtonItem3 = new TD.SandBar.MenuButtonItem();
			this.menuButtonItem2 = new TD.SandBar.MenuButtonItem();
			this.menuButtonItemRefresh = new TD.SandBar.MenuButtonItem();
			this.menuBarItemManage = new TD.SandBar.MenuBarItem();
			this.menuButtonItemConfig = new TD.SandBar.MenuButtonItem();
			this.menuButtonItemAddBook = new TD.SandBar.MenuButtonItem();
			this.menuButtonItemEditBook = new TD.SandBar.MenuButtonItem();
			this.menuButtonItemDelBook = new TD.SandBar.MenuButtonItem();
			this.menuButtonItemDelTest = new TD.SandBar.MenuButtonItem();
			this.menuBarItem4 = new TD.SandBar.MenuBarItem();
			this.menuButtonItemETQuestion = new TD.SandBar.MenuButtonItem();
			this.menuButtonItemETTape = new TD.SandBar.MenuButtonItem();
			this.menuButtonItemETAnswer = new TD.SandBar.MenuButtonItem();
			this.menuBarItem5 = new TD.SandBar.MenuBarItem();
			this.menuButtonItemHelp = new TD.SandBar.MenuButtonItem();
			this.menuButtonItemAbout = new TD.SandBar.MenuButtonItem();
			this.toolBarStandard = new TD.SandBar.ToolBar();
			this.buttonItemFileNew = new TD.SandBar.ButtonItem();
			this.buttonItemFileOpen = new TD.SandBar.ButtonItem();
			this.buttonItemFileSave = new TD.SandBar.ButtonItem();
			this.buttonItemFilePreview = new TD.SandBar.ButtonItem();
			this.buttonItemHelp = new TD.SandBar.ButtonItem();
			this.sandDockManager2 = new TD.SandDock.SandDockManager();
			this.rightSandDock = new TD.SandDock.DockContainer();
			this.bottomSandDock = new TD.SandDock.DockContainer();
			this.topSandDock = new TD.SandDock.DockContainer();
			this.documentContainer1 = new TD.SandDock.DocumentContainer();
			this.dockControlDetailInfo = new TD.SandDock.DockControl();
			this.panel1 = new System.Windows.Forms.Panel();
			this.axWebBrowser1 = new AxSHDocVw.AxWebBrowser();
			this.statusBar1 = new System.Windows.Forms.StatusBar();
			this.statusBarPanel1 = new System.Windows.Forms.StatusBarPanel();
			this.statusBarPanel2 = new System.Windows.Forms.StatusBarPanel();
			this.statusBarPanel3 = new System.Windows.Forms.StatusBarPanel();
			this.dockControlExamTest = new TD.SandDock.DockControl();
			this.panel2 = new System.Windows.Forms.Panel();
			this.axWebBrowser2 = new AxSHDocVw.AxWebBrowser();
			this.statusBar3 = new System.Windows.Forms.StatusBar();
			this.statusBarPanel7 = new System.Windows.Forms.StatusBarPanel();
			this.statusBarPanel8 = new System.Windows.Forms.StatusBarPanel();
			this.statusBarPanel9 = new System.Windows.Forms.StatusBarPanel();
			this.dockControlExamTestTree = new TD.SandDock.DockControl();
			this.treeViewExamTest = new System.Windows.Forms.TreeView();
			this.statusBar2 = new System.Windows.Forms.StatusBar();
			this.statusBarPanel4 = new System.Windows.Forms.StatusBarPanel();
			this.statusBarPanel5 = new System.Windows.Forms.StatusBarPanel();
			this.statusBarPanel6 = new System.Windows.Forms.StatusBarPanel();
			this.oleDbConnection1 = new System.Data.OleDb.OleDbConnection();
			this.dockControlQuestionTree = new TD.SandDock.DockControl();
			this.treeViewQuestion = new System.Windows.Forms.TreeView();
			this.leftSandDock = new TD.SandDock.DockContainer();
			this.topSandBarDock.SuspendLayout();
			this.documentContainer1.SuspendLayout();
			this.dockControlDetailInfo.SuspendLayout();
			this.panel1.SuspendLayout();
			((System.ComponentModel.ISupportInitialize)(this.axWebBrowser1)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.statusBarPanel1)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.statusBarPanel2)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.statusBarPanel3)).BeginInit();
			this.dockControlExamTest.SuspendLayout();
			this.panel2.SuspendLayout();
			((System.ComponentModel.ISupportInitialize)(this.axWebBrowser2)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.statusBarPanel7)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.statusBarPanel8)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.statusBarPanel9)).BeginInit();
			this.dockControlExamTestTree.SuspendLayout();
			((System.ComponentModel.ISupportInitialize)(this.statusBarPanel4)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.statusBarPanel5)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.statusBarPanel6)).BeginInit();
			this.dockControlQuestionTree.SuspendLayout();
			this.leftSandDock.SuspendLayout();
			this.SuspendLayout();
			// 
			// sandDockManager1
			// 
			this.sandDockManager1.OwnerForm = this;
			// 
			// sandBarManager1
			// 
			this.sandBarManager1.OwnerForm = this;
			// 
			// sandBarManager2
			// 
			this.sandBarManager2.OwnerForm = this;
			// 
			// leftSandBarDock
			// 
			this.leftSandBarDock.Dock = System.Windows.Forms.DockStyle.Left;
			this.leftSandBarDock.Guid = new System.Guid("ee412bb6-e1ed-414c-a0d2-9faf04b85668");
			this.leftSandBarDock.Location = new System.Drawing.Point(0, 54);
			this.leftSandBarDock.Manager = this.sandBarManager2;
			this.leftSandBarDock.Name = "leftSandBarDock";
			this.leftSandBarDock.Size = new System.Drawing.Size(0, 584);
			this.leftSandBarDock.TabIndex = 0;
			// 
			// rightSandBarDock
			// 
			this.rightSandBarDock.Dock = System.Windows.Forms.DockStyle.Right;
			this.rightSandBarDock.Guid = new System.Guid("45edd700-6b6b-4c45-9275-4c1c0de80f6a");
			this.rightSandBarDock.Location = new System.Drawing.Point(1008, 54);
			this.rightSandBarDock.Manager = this.sandBarManager2;
			this.rightSandBarDock.Name = "rightSandBarDock";
			this.rightSandBarDock.Size = new System.Drawing.Size(0, 584);
			this.rightSandBarDock.TabIndex = 1;
			// 
			// bottomSandBarDock
			// 
			this.bottomSandBarDock.Dock = System.Windows.Forms.DockStyle.Bottom;
			this.bottomSandBarDock.Guid = new System.Guid("c7d98bf9-26fe-4378-8d0a-52eed0220698");
			this.bottomSandBarDock.Location = new System.Drawing.Point(0, 638);
			this.bottomSandBarDock.Manager = this.sandBarManager2;
			this.bottomSandBarDock.Name = "bottomSandBarDock";
			this.bottomSandBarDock.Size = new System.Drawing.Size(1008, 0);
			this.bottomSandBarDock.TabIndex = 2;
			// 
			// topSandBarDock
			// 
			this.topSandBarDock.Controls.Add(this.toolBarTopicQues);
			this.topSandBarDock.Controls.Add(this.toolBarExamTest);
			this.topSandBarDock.Controls.Add(this.menuBar1);
			this.topSandBarDock.Controls.Add(this.toolBarStandard);
			this.topSandBarDock.Dock = System.Windows.Forms.DockStyle.Top;
			this.topSandBarDock.Guid = new System.Guid("3f47bbbf-9a85-4ae4-8901-d3b84568716d");
			this.topSandBarDock.Location = new System.Drawing.Point(0, 0);
			this.topSandBarDock.Manager = this.sandBarManager2;
			this.topSandBarDock.Name = "topSandBarDock";
			this.topSandBarDock.Size = new System.Drawing.Size(1008, 54);
			this.topSandBarDock.TabIndex = 3;
			// 
			// toolBarExamTest
			// 
			this.toolBarExamTest.DockLine = 1;
			this.toolBarExamTest.Guid = new System.Guid("a9bdae0a-5f03-442b-82d7-b90cc654099e");
			this.toolBarExamTest.Items.AddRange(new TD.SandBar.ToolbarItemBase[] {
																					 this.buttonItemExamTestNoModify,
																					 this.buttonItemExamTestCanModify,
																					 this.buttonItemExamTestRefresh,
																					 this.buttonItemMoveUp,
																					 this.buttonItemMoveDown,
																					 this.buttonItemRemoveItem,
																					 this.buttonItemEInfo,
																					 this.buttonItemETest,
																					 this.buttonItemETape,
																					 this.buttonItemEAns,
																					 this.buttonItemEBuild,
																					 this.buttonItemESound});
			this.toolBarExamTest.Location = new System.Drawing.Point(150, 28);
			this.toolBarExamTest.Name = "toolBarExamTest";
			this.toolBarExamTest.Resizable = false;
			this.toolBarExamTest.ShowShortcutsInToolTips = true;
			this.toolBarExamTest.Size = new System.Drawing.Size(321, 26);
			this.toolBarExamTest.TabIndex = 3;
			this.toolBarExamTest.Text = "ExamTest Toolbar";
			// 
			// buttonItemExamTestNoModify
			// 
			this.buttonItemExamTestNoModify.BeginGroup = true;
			this.buttonItemExamTestNoModify.Image = ((System.Drawing.Image)(resources.GetObject("buttonItemExamTestNoModify.Image")));
			this.buttonItemExamTestNoModify.ToolTipText = "Modify ExamTest";
			this.buttonItemExamTestNoModify.Activate += new System.EventHandler(this.buttonItemExamTestModify_Change);
			// 
			// buttonItemExamTestCanModify
			// 
			this.buttonItemExamTestCanModify.Image = ((System.Drawing.Image)(resources.GetObject("buttonItemExamTestCanModify.Image")));
			this.buttonItemExamTestCanModify.ToolTipText = "UnModify ExamTest & Modify QuestionTest";
			this.buttonItemExamTestCanModify.Visible = false;
			this.buttonItemExamTestCanModify.Activate += new System.EventHandler(this.buttonItemExamTestModify_Change);
			// 
			// buttonItemExamTestRefresh
			// 
			this.buttonItemExamTestRefresh.BeginGroup = true;
			this.buttonItemExamTestRefresh.Icon = ((System.Drawing.Icon)(resources.GetObject("buttonItemExamTestRefresh.Icon")));
			this.buttonItemExamTestRefresh.Image = ((System.Drawing.Image)(resources.GetObject("buttonItemExamTestRefresh.Image")));
			this.buttonItemExamTestRefresh.ToolTipText = "Refresh ExamTest to AllView";
			this.buttonItemExamTestRefresh.Activate += new System.EventHandler(this.buttonItemExamTestRefresh_Activate);
			// 
			// buttonItemMoveUp
			// 
			this.buttonItemMoveUp.Image = ((System.Drawing.Image)(resources.GetObject("buttonItemMoveUp.Image")));
			this.buttonItemMoveUp.ToolTipText = "Move Up";
			this.buttonItemMoveUp.Activate += new System.EventHandler(this.buttonItemMoveUp_Activate);
			// 
			// buttonItemMoveDown
			// 
			this.buttonItemMoveDown.Icon = ((System.Drawing.Icon)(resources.GetObject("buttonItemMoveDown.Icon")));
			this.buttonItemMoveDown.Image = ((System.Drawing.Image)(resources.GetObject("buttonItemMoveDown.Image")));
			this.buttonItemMoveDown.ToolTipText = "Move Down";
			this.buttonItemMoveDown.Activate += new System.EventHandler(this.buttonItemMoveDown_Activate);
			// 
			// buttonItemRemoveItem
			// 
			this.buttonItemRemoveItem.Image = ((System.Drawing.Image)(resources.GetObject("buttonItemRemoveItem.Image")));
			this.buttonItemRemoveItem.Activate += new System.EventHandler(this.buttonItemRemoveItem_Activate);
			// 
			// buttonItemEInfo
			// 
			this.buttonItemEInfo.Icon = ((System.Drawing.Icon)(resources.GetObject("buttonItemEInfo.Icon")));
			this.buttonItemEInfo.ToolTipText = "ExamTest Infomations";
			this.buttonItemEInfo.Activate += new System.EventHandler(this.buttonItemEInfo_Activate);
			// 
			// buttonItemETest
			// 
			this.buttonItemETest.BeginGroup = true;
			this.buttonItemETest.Image = ((System.Drawing.Image)(resources.GetObject("buttonItemETest.Image")));
			this.buttonItemETest.ToolTipText = "ExamTest Question";
			this.buttonItemETest.Activate += new System.EventHandler(this.menuButtonItemETWindow_Activate);
			// 
			// buttonItemETape
			// 
			this.buttonItemETape.Image = ((System.Drawing.Image)(resources.GetObject("buttonItemETape.Image")));
			this.buttonItemETape.ToolTipText = "ExamTest Tape Script";
			this.buttonItemETape.Activate += new System.EventHandler(this.menuButtonItemETWindow_Activate);
			// 
			// buttonItemEAns
			// 
			this.buttonItemEAns.Image = ((System.Drawing.Image)(resources.GetObject("buttonItemEAns.Image")));
			this.buttonItemEAns.ToolTipText = "ExamTest Answer Key";
			this.buttonItemEAns.Activate += new System.EventHandler(this.menuButtonItemETWindow_Activate);
			// 
			// buttonItemEBuild
			// 
			this.buttonItemEBuild.BeginGroup = true;
			this.buttonItemEBuild.Icon = ((System.Drawing.Icon)(resources.GetObject("buttonItemEBuild.Icon")));
			this.buttonItemEBuild.Image = ((System.Drawing.Image)(resources.GetObject("buttonItemEBuild.Image")));
			this.buttonItemEBuild.ToolTipText = "Build Full Report";
			this.buttonItemEBuild.Activate += new System.EventHandler(this.buttonItemEBuild_Activate);
			// 
			// buttonItemESound
			// 
			this.buttonItemESound.Icon = ((System.Drawing.Icon)(resources.GetObject("buttonItemESound.Icon")));
			this.buttonItemESound.Image = ((System.Drawing.Image)(resources.GetObject("buttonItemESound.Image")));
			this.buttonItemESound.ToolTipText = "Make Sound Tape";
			this.buttonItemESound.Activate += new System.EventHandler(this.buttonItemESound_Activate);
			// 
			// toolBarTopicQues
			// 
			this.toolBarTopicQues.DockLine = 1;
			this.toolBarTopicQues.Guid = new System.Guid("a9bdae0a-5f03-442b-82d7-b90cc654099e");
			this.toolBarTopicQues.Items.AddRange(new TD.SandBar.ToolbarItemBase[] {
																					  this.buttonItemTAdd,
																					  this.buttonItemTDel,
																					  this.buttonItemTEdit,
																					  this.buttonItemTPlay,
																					  this.buttonItemQAdd,
																					  this.buttonItemQDel,
																					  this.buttonItemQEdit,
																					  this.buttonItemQPlay});
			this.toolBarTopicQues.Location = new System.Drawing.Point(473, 28);
			this.toolBarTopicQues.Name = "toolBarTopicQues";
			this.toolBarTopicQues.Size = new System.Drawing.Size(215, 26);
			this.toolBarTopicQues.TabIndex = 2;
			this.toolBarTopicQues.Text = "Question & Topic Toolbar";
			// 
			// buttonItemTAdd
			// 
			this.buttonItemTAdd.Icon = ((System.Drawing.Icon)(resources.GetObject("buttonItemTAdd.Icon")));
			this.buttonItemTAdd.ToolTipText = "Add New Topic";
			this.buttonItemTAdd.Activate += new System.EventHandler(this.buttonItemTAdd_Activate);
			// 
			// buttonItemTDel
			// 
			this.buttonItemTDel.Image = ((System.Drawing.Image)(resources.GetObject("buttonItemTDel.Image")));
			this.buttonItemTDel.ToolTipText = "Delete Current Topic";
			this.buttonItemTDel.Activate += new System.EventHandler(this.buttonItemTDel_Activate);
			// 
			// buttonItemTEdit
			// 
			this.buttonItemTEdit.Icon = ((System.Drawing.Icon)(resources.GetObject("buttonItemTEdit.Icon")));
			this.buttonItemTEdit.ToolTipText = "Edit Current Topic";
			this.buttonItemTEdit.Activate += new System.EventHandler(this.buttonItemTEdit_Activate);
			// 
			// buttonItemTPlay
			// 
			this.buttonItemTPlay.Image = ((System.Drawing.Image)(resources.GetObject("buttonItemTPlay.Image")));
			this.buttonItemTPlay.ToolTipText = "Play Sound of Topic";
			this.buttonItemTPlay.Activate += new System.EventHandler(this.buttonItemTPlay_Activate);
			// 
			// buttonItemQAdd
			// 
			this.buttonItemQAdd.BeginGroup = true;
			this.buttonItemQAdd.Icon = ((System.Drawing.Icon)(resources.GetObject("buttonItemQAdd.Icon")));
			this.buttonItemQAdd.ToolTipText = "Add New Question";
			this.buttonItemQAdd.Activate += new System.EventHandler(this.buttonItemQAdd_Activate);
			// 
			// buttonItemQDel
			// 
			this.buttonItemQDel.Image = ((System.Drawing.Image)(resources.GetObject("buttonItemQDel.Image")));
			this.buttonItemQDel.ToolTipText = "Delete Current Question";
			this.buttonItemQDel.Activate += new System.EventHandler(this.buttonItemQDel_Activate);
			// 
			// buttonItemQEdit
			// 
			this.buttonItemQEdit.Icon = ((System.Drawing.Icon)(resources.GetObject("buttonItemQEdit.Icon")));
			this.buttonItemQEdit.ToolTipText = "Edit Current Question";
			this.buttonItemQEdit.Activate += new System.EventHandler(this.buttonItemQEdit_Activate);
			// 
			// buttonItemQPlay
			// 
			this.buttonItemQPlay.Image = ((System.Drawing.Image)(resources.GetObject("buttonItemQPlay.Image")));
			this.buttonItemQPlay.ToolTipText = "Play Sound of Question";
			this.buttonItemQPlay.Activate += new System.EventHandler(this.buttonItemQPlay_Activate);
			// 
			// menuBar1
			// 
			this.menuBar1.Guid = new System.Guid("7c942114-c372-4217-8647-4d6962face21");
			this.menuBar1.Items.AddRange(new TD.SandBar.ToolbarItemBase[] {
																			  this.menuBarItem1,
																			  this.menuBarItem2,
																			  this.menuBarItemView,
																			  this.menuBarItemTest,
																			  this.menuBarItemManage,
																			  this.menuBarItem4,
																			  this.menuBarItem5});
			this.menuBar1.Location = new System.Drawing.Point(2, 0);
			this.menuBar1.Name = "menuBar1";
			this.menuBar1.OwnerForm = this;
			this.menuBar1.Size = new System.Drawing.Size(1006, 28);
			this.menuBar1.TabIndex = 0;
			this.menuBar1.Text = "menuBar1";
			// 
			// menuBarItem1
			// 
			this.menuBarItem1.Items.AddRange(new TD.SandBar.ToolbarItemBase[] {
																				  this.menuButtonItemFileNew,
																				  this.menuButtonItemFileOpen,
																				  this.menuButtonItemFileSave,
																				  this.menuButtonItemFileSaveAs,
																				  this.menuButtonItemFilePreview,
																				  this.menuButtonItemChangePass,
																				  this.menuButtonItemFileExit});
			this.menuBarItem1.Text = "&File";
			// 
			// menuButtonItemFileNew
			// 
			this.menuButtonItemFileNew.Image = ((System.Drawing.Image)(resources.GetObject("menuButtonItemFileNew.Image")));
			this.menuButtonItemFileNew.Shortcut = System.Windows.Forms.Shortcut.CtrlN;
			this.menuButtonItemFileNew.Text = "&New";
			this.menuButtonItemFileNew.Activate += new System.EventHandler(this.buttonItemFileNew_Activate);
			// 
			// menuButtonItemFileOpen
			// 
			this.menuButtonItemFileOpen.Image = ((System.Drawing.Image)(resources.GetObject("menuButtonItemFileOpen.Image")));
			this.menuButtonItemFileOpen.Shortcut = System.Windows.Forms.Shortcut.CtrlO;
			this.menuButtonItemFileOpen.Text = "&Open";
			this.menuButtonItemFileOpen.Activate += new System.EventHandler(this.buttonItemFileOpen_Activate);
			// 
			// menuButtonItemFileSave
			// 
			this.menuButtonItemFileSave.Image = ((System.Drawing.Image)(resources.GetObject("menuButtonItemFileSave.Image")));
			this.menuButtonItemFileSave.Shortcut = System.Windows.Forms.Shortcut.CtrlS;
			this.menuButtonItemFileSave.Text = "&Save";
			this.menuButtonItemFileSave.Activate += new System.EventHandler(this.buttonItemFileSave_Activate);
			// 
			// menuButtonItemFileSaveAs
			// 
			this.menuButtonItemFileSaveAs.Image = ((System.Drawing.Image)(resources.GetObject("menuButtonItemFileSaveAs.Image")));
			this.menuButtonItemFileSaveAs.Text = "Save &As...";
			this.menuButtonItemFileSaveAs.Activate += new System.EventHandler(this.menuButtonItemFileSaveAs_Activate);
			// 
			// menuButtonItemFilePreview
			// 
			this.menuButtonItemFilePreview.Image = ((System.Drawing.Image)(resources.GetObject("menuButtonItemFilePreview.Image")));
			this.menuButtonItemFilePreview.Text = "Print Pre&view...";
			this.menuButtonItemFilePreview.Activate += new System.EventHandler(this.buttonItemEBuild_Activate);
			// 
			// menuButtonItemChangePass
			// 
			this.menuButtonItemChangePass.BeginGroup = true;
			this.menuButtonItemChangePass.Icon = ((System.Drawing.Icon)(resources.GetObject("menuButtonItemChangePass.Icon")));
			this.menuButtonItemChangePass.Text = "Change &Password";
			this.menuButtonItemChangePass.Activate += new System.EventHandler(this.menuButtonItemChangePass_Activate);
			// 
			// menuButtonItemFileExit
			// 
			this.menuButtonItemFileExit.BeginGroup = true;
			this.menuButtonItemFileExit.Shortcut = System.Windows.Forms.Shortcut.AltF4;
			this.menuButtonItemFileExit.Text = "E&xit";
			this.menuButtonItemFileExit.Activate += new System.EventHandler(this.menuButtonItemFileExit_Activate);
			// 
			// menuBarItem2
			// 
			this.menuBarItem2.Items.AddRange(new TD.SandBar.ToolbarItemBase[] {
																				  this.menuButtonItemAddQues,
																				  this.menuButtonItemEditQues,
																				  this.menuButtonItemDelQues,
																				  this.menuButtonItemAddTop,
																				  this.menuButtonItemEditTop,
																				  this.menuButtonItemDelTop});
			this.menuBarItem2.Text = "&Edit";
			// 
			// menuButtonItemAddQues
			// 
			this.menuButtonItemAddQues.Icon = ((System.Drawing.Icon)(resources.GetObject("menuButtonItemAddQues.Icon")));
			this.menuButtonItemAddQues.Text = "&Add Question";
			// 
			// menuButtonItemEditQues
			// 
			this.menuButtonItemEditQues.Icon = ((System.Drawing.Icon)(resources.GetObject("menuButtonItemEditQues.Icon")));
			this.menuButtonItemEditQues.Text = "&Edit Question";
			// 
			// menuButtonItemDelQues
			// 
			this.menuButtonItemDelQues.Icon = ((System.Drawing.Icon)(resources.GetObject("menuButtonItemDelQues.Icon")));
			this.menuButtonItemDelQues.Text = "&Del Question";
			// 
			// menuButtonItemAddTop
			// 
			this.menuButtonItemAddTop.BeginGroup = true;
			this.menuButtonItemAddTop.Icon = ((System.Drawing.Icon)(resources.GetObject("menuButtonItemAddTop.Icon")));
			this.menuButtonItemAddTop.Text = "&Add Topic";
			// 
			// menuButtonItemEditTop
			// 
			this.menuButtonItemEditTop.Icon = ((System.Drawing.Icon)(resources.GetObject("menuButtonItemEditTop.Icon")));
			this.menuButtonItemEditTop.Text = "&Edit Topic";
			// 
			// menuButtonItemDelTop
			// 
			this.menuButtonItemDelTop.Icon = ((System.Drawing.Icon)(resources.GetObject("menuButtonItemDelTop.Icon")));
			this.menuButtonItemDelTop.Text = "&Del Topic";
			// 
			// menuBarItemView
			// 
			this.menuBarItemView.Items.AddRange(new TD.SandBar.ToolbarItemBase[] {
																					 this.menuButtonItemStandardToolbar,
																					 this.menuButtonItemQuestionToolbar,
																					 this.menuButtonItemExamTestToolbar,
																					 this.menuButtonItemQuestionsTreeView,
																					 this.menuButtonItemExamTestTreeView,
																					 this.menuButtonItemDetailInfomations,
																					 this.menuButtonItemExamTestDetail});
			this.menuBarItemView.Text = "&View";
			this.menuBarItemView.BeforePopup += new TD.SandBar.MenuItemBase.BeforePopupEventHandler(this.menuBarItemView_BeforePopup);
			// 
			// menuButtonItemStandardToolbar
			// 
			this.menuButtonItemStandardToolbar.Text = "&Standard Toolbar";
			this.menuButtonItemStandardToolbar.Activate += new System.EventHandler(this.menuButtonItemStandardToolbar_Activate);
			// 
			// menuButtonItemQuestionToolbar
			// 
			this.menuButtonItemQuestionToolbar.Text = "&Question Toolbar";
			this.menuButtonItemQuestionToolbar.Activate += new System.EventHandler(this.menuButtonItemQuestionToolbar_Activate);
			// 
			// menuButtonItemExamTestToolbar
			// 
			this.menuButtonItemExamTestToolbar.Text = "&ExamTest Toolbar";
			this.menuButtonItemExamTestToolbar.Activate += new System.EventHandler(this.menuButtonItemExamTestToolbar_Activate);
			// 
			// menuButtonItemQuestionsTreeView
			// 
			this.menuButtonItemQuestionsTreeView.BeginGroup = true;
			this.menuButtonItemQuestionsTreeView.Shortcut = System.Windows.Forms.Shortcut.CtrlF5;
			this.menuButtonItemQuestionsTreeView.Text = "Questions TreeView";
			this.menuButtonItemQuestionsTreeView.Activate += new System.EventHandler(this.menuButtonItemQuestionsTreeView_Activate);
			// 
			// menuButtonItemExamTestTreeView
			// 
			this.menuButtonItemExamTestTreeView.Shortcut = System.Windows.Forms.Shortcut.CtrlF6;
			this.menuButtonItemExamTestTreeView.Text = "ExamTest TreeView";
			this.menuButtonItemExamTestTreeView.Activate += new System.EventHandler(this.menuButtonItemExamTestTreeView_Activate);
			// 
			// menuButtonItemDetailInfomations
			// 
			this.menuButtonItemDetailInfomations.BeginGroup = true;
			this.menuButtonItemDetailInfomations.Shortcut = System.Windows.Forms.Shortcut.CtrlF7;
			this.menuButtonItemDetailInfomations.Text = "Detail Infomations";
			this.menuButtonItemDetailInfomations.Activate += new System.EventHandler(this.menuButtonItemDetailInfomations_Activate);
			// 
			// menuButtonItemExamTestDetail
			// 
			this.menuButtonItemExamTestDetail.Shortcut = System.Windows.Forms.Shortcut.CtrlF7;
			this.menuButtonItemExamTestDetail.Text = "ExamTest Detail";
			this.menuButtonItemExamTestDetail.Activate += new System.EventHandler(this.menuButtonItemExamTestDetail_Activate);
			// 
			// menuBarItemTest
			// 
			this.menuBarItemTest.Items.AddRange(new TD.SandBar.ToolbarItemBase[] {
																					 this.menuButtonItemModifyExamTest,
																					 this.menuButtonItemMoveUp,
																					 this.menuButtonItemMoveDown,
																					 this.menuButtonItemRemoveItem,
																					 this.menuButtonItemFileProperties,
																					 this.menuButtonItem3,
																					 this.menuButtonItem2,
																					 this.menuButtonItemRefresh});
			this.menuBarItemTest.Text = "&Test";
			// 
			// menuButtonItemModifyExamTest
			// 
			this.menuButtonItemModifyExamTest.Icon = ((System.Drawing.Icon)(resources.GetObject("menuButtonItemModifyExamTest.Icon")));
			this.menuButtonItemModifyExamTest.Shortcut = System.Windows.Forms.Shortcut.CtrlM;
			this.menuButtonItemModifyExamTest.Tag = "Modify ExamTest";
			this.menuButtonItemModifyExamTest.Text = "&Modify ExamTest";
			this.menuButtonItemModifyExamTest.Activate += new System.EventHandler(this.buttonItemExamTestModify_Change);
			// 
			// menuButtonItemMoveUp
			// 
			this.menuButtonItemMoveUp.BeginGroup = true;
			this.menuButtonItemMoveUp.Image = ((System.Drawing.Image)(resources.GetObject("menuButtonItemMoveUp.Image")));
			this.menuButtonItemMoveUp.Shortcut = System.Windows.Forms.Shortcut.CtrlU;
			this.menuButtonItemMoveUp.Text = "Move &Up Setected Item";
			this.menuButtonItemMoveUp.Activate += new System.EventHandler(this.buttonItemMoveUp_Activate);
			// 
			// menuButtonItemMoveDown
			// 
			this.menuButtonItemMoveDown.Image = ((System.Drawing.Image)(resources.GetObject("menuButtonItemMoveDown.Image")));
			this.menuButtonItemMoveDown.Shortcut = System.Windows.Forms.Shortcut.CtrlD;
			this.menuButtonItemMoveDown.Text = "Move &Down Setected Item";
			this.menuButtonItemMoveDown.Activate += new System.EventHandler(this.buttonItemMoveDown_Activate);
			// 
			// menuButtonItemRemoveItem
			// 
			this.menuButtonItemRemoveItem.Image = ((System.Drawing.Image)(resources.GetObject("menuButtonItemRemoveItem.Image")));
			this.menuButtonItemRemoveItem.Shortcut = System.Windows.Forms.Shortcut.Del;
			this.menuButtonItemRemoveItem.Text = "&Remove Selected Item";
			this.menuButtonItemRemoveItem.Activate += new System.EventHandler(this.buttonItemRemoveItem_Activate);
			// 
			// menuButtonItemFileProperties
			// 
			this.menuButtonItemFileProperties.BeginGroup = true;
			this.menuButtonItemFileProperties.Image = ((System.Drawing.Image)(resources.GetObject("menuButtonItemFileProperties.Image")));
			this.menuButtonItemFileProperties.Shortcut = System.Windows.Forms.Shortcut.CtrlP;
			this.menuButtonItemFileProperties.Text = "Test &Propert&ies...";
			this.menuButtonItemFileProperties.Activate += new System.EventHandler(this.buttonItemEInfo_Activate);
			// 
			// menuButtonItem3
			// 
			this.menuButtonItem3.Icon = ((System.Drawing.Icon)(resources.GetObject("menuButtonItem3.Icon")));
			this.menuButtonItem3.Shortcut = System.Windows.Forms.Shortcut.CtrlR;
			this.menuButtonItem3.Text = "&Generate Report";
			this.menuButtonItem3.Activate += new System.EventHandler(this.buttonItemEBuild_Activate);
			// 
			// menuButtonItem2
			// 
			this.menuButtonItem2.Icon = ((System.Drawing.Icon)(resources.GetObject("menuButtonItem2.Icon")));
			this.menuButtonItem2.Image = ((System.Drawing.Image)(resources.GetObject("menuButtonItem2.Image")));
			this.menuButtonItem2.Shortcut = System.Windows.Forms.Shortcut.CtrlF12;
			this.menuButtonItem2.Text = "Make &Sound Tape...";
			this.menuButtonItem2.Activate += new System.EventHandler(this.buttonItemESound_Activate);
			// 
			// menuButtonItemRefresh
			// 
			this.menuButtonItemRefresh.Icon = ((System.Drawing.Icon)(resources.GetObject("menuButtonItemRefresh.Icon")));
			this.menuButtonItemRefresh.Shortcut = System.Windows.Forms.Shortcut.F5;
			this.menuButtonItemRefresh.Text = "Re&fresh";
			this.menuButtonItemRefresh.Activate += new System.EventHandler(this.buttonItemExamTestRefresh_Activate);
			// 
			// menuBarItemManage
			// 
			this.menuBarItemManage.Items.AddRange(new TD.SandBar.ToolbarItemBase[] {
																					   this.menuButtonItemConfig,
																					   this.menuButtonItemAddBook,
																					   this.menuButtonItemEditBook,
																					   this.menuButtonItemDelBook,
																					   this.menuButtonItemDelTest});
			this.menuBarItemManage.Text = "&Manage";
			// 
			// menuButtonItemConfig
			// 
			this.menuButtonItemConfig.Icon = ((System.Drawing.Icon)(resources.GetObject("menuButtonItemConfig.Icon")));
			this.menuButtonItemConfig.Shortcut = System.Windows.Forms.Shortcut.F9;
			this.menuButtonItemConfig.Text = "&Configurate";
			this.menuButtonItemConfig.Activate += new System.EventHandler(this.menuButtonItemConfig_Activate);
			// 
			// menuButtonItemAddBook
			// 
			this.menuButtonItemAddBook.BeginGroup = true;
			this.menuButtonItemAddBook.Icon = ((System.Drawing.Icon)(resources.GetObject("menuButtonItemAddBook.Icon")));
			this.menuButtonItemAddBook.Text = "&Add Book";
			this.menuButtonItemAddBook.Activate += new System.EventHandler(this.menuButtonItemAddBook_Activate);
			// 
			// menuButtonItemEditBook
			// 
			this.menuButtonItemEditBook.Icon = ((System.Drawing.Icon)(resources.GetObject("menuButtonItemEditBook.Icon")));
			this.menuButtonItemEditBook.Text = "&Edit Book";
			this.menuButtonItemEditBook.Activate += new System.EventHandler(this.menuButtonItemEditBook_Activate);
			// 
			// menuButtonItemDelBook
			// 
			this.menuButtonItemDelBook.Icon = ((System.Drawing.Icon)(resources.GetObject("menuButtonItemDelBook.Icon")));
			this.menuButtonItemDelBook.Text = "&Delete Book";
			this.menuButtonItemDelBook.Activate += new System.EventHandler(this.menuButtonItemEditBook_Activate);
			// 
			// menuButtonItemDelTest
			// 
			this.menuButtonItemDelTest.BeginGroup = true;
			this.menuButtonItemDelTest.Icon = ((System.Drawing.Icon)(resources.GetObject("menuButtonItemDelTest.Icon")));
			this.menuButtonItemDelTest.Text = "Delete &Test";
			this.menuButtonItemDelTest.Activate += new System.EventHandler(this.menuButtonItemDelTest_Activate);
			// 
			// menuBarItem4
			// 
			this.menuBarItem4.Items.AddRange(new TD.SandBar.ToolbarItemBase[] {
																				  this.menuButtonItemETQuestion,
																				  this.menuButtonItemETTape,
																				  this.menuButtonItemETAnswer});
			this.menuBarItem4.MdiWindowList = true;
			this.menuBarItem4.Text = "&Window";
			// 
			// menuButtonItemETQuestion
			// 
			this.menuButtonItemETQuestion.Icon = ((System.Drawing.Icon)(resources.GetObject("menuButtonItemETQuestion.Icon")));
			this.menuButtonItemETQuestion.Shortcut = System.Windows.Forms.Shortcut.CtrlF8;
			this.menuButtonItemETQuestion.Text = "ExamTest &Question";
			this.menuButtonItemETQuestion.Activate += new System.EventHandler(this.menuButtonItemETWindow_Activate);
			// 
			// menuButtonItemETTape
			// 
			this.menuButtonItemETTape.Image = ((System.Drawing.Image)(resources.GetObject("menuButtonItemETTape.Image")));
			this.menuButtonItemETTape.Shortcut = System.Windows.Forms.Shortcut.CtrlF9;
			this.menuButtonItemETTape.Text = "ExamTest &Tape Script";
			this.menuButtonItemETTape.Activate += new System.EventHandler(this.menuButtonItemETWindow_Activate);
			// 
			// menuButtonItemETAnswer
			// 
			this.menuButtonItemETAnswer.Image = ((System.Drawing.Image)(resources.GetObject("menuButtonItemETAnswer.Image")));
			this.menuButtonItemETAnswer.Shortcut = System.Windows.Forms.Shortcut.CtrlF10;
			this.menuButtonItemETAnswer.Text = "ExamTest &Answer Key";
			this.menuButtonItemETAnswer.Activate += new System.EventHandler(this.menuButtonItemETWindow_Activate);
			// 
			// menuBarItem5
			// 
			this.menuBarItem5.Items.AddRange(new TD.SandBar.ToolbarItemBase[] {
																				  this.menuButtonItemHelp,
																				  this.menuButtonItemAbout});
			this.menuBarItem5.Text = "&Help";
			// 
			// menuButtonItemHelp
			// 
			this.menuButtonItemHelp.Icon = ((System.Drawing.Icon)(resources.GetObject("menuButtonItemHelp.Icon")));
			this.menuButtonItemHelp.Image = ((System.Drawing.Image)(resources.GetObject("menuButtonItemHelp.Image")));
			this.menuButtonItemHelp.Shortcut = System.Windows.Forms.Shortcut.F1;
			this.menuButtonItemHelp.Text = "&Help";
			this.menuButtonItemHelp.Activate += new System.EventHandler(this.menuButtonItemHelp_Activate);
			// 
			// menuButtonItemAbout
			// 
			this.menuButtonItemAbout.Icon = ((System.Drawing.Icon)(resources.GetObject("menuButtonItemAbout.Icon")));
			this.menuButtonItemAbout.Text = "&About etbTOEIC";
			this.menuButtonItemAbout.Activate += new System.EventHandler(this.menuButtonItemAbout_Activate);
			// 
			// toolBarStandard
			// 
			this.toolBarStandard.DockLine = 1;
			this.toolBarStandard.Guid = new System.Guid("a9bdae0a-5f03-442b-82d7-b90cc654099e");
			this.toolBarStandard.Items.AddRange(new TD.SandBar.ToolbarItemBase[] {
																					 this.buttonItemFileNew,
																					 this.buttonItemFileOpen,
																					 this.buttonItemFileSave,
																					 this.buttonItemFilePreview,
																					 this.buttonItemHelp});
			this.toolBarStandard.Location = new System.Drawing.Point(2, 28);
			this.toolBarStandard.Name = "toolBarStandard";
			this.toolBarStandard.Resizable = false;
			this.toolBarStandard.Size = new System.Drawing.Size(146, 26);
			this.toolBarStandard.TabIndex = 1;
			this.toolBarStandard.Text = "Standard ToolBar";
			// 
			// buttonItemFileNew
			// 
			this.buttonItemFileNew.Icon = ((System.Drawing.Icon)(resources.GetObject("buttonItemFileNew.Icon")));
			this.buttonItemFileNew.Image = ((System.Drawing.Image)(resources.GetObject("buttonItemFileNew.Image")));
			this.buttonItemFileNew.ToolTipText = "New Test";
			this.buttonItemFileNew.Activate += new System.EventHandler(this.buttonItemFileNew_Activate);
			// 
			// buttonItemFileOpen
			// 
			this.buttonItemFileOpen.Icon = ((System.Drawing.Icon)(resources.GetObject("buttonItemFileOpen.Icon")));
			this.buttonItemFileOpen.Image = ((System.Drawing.Image)(resources.GetObject("buttonItemFileOpen.Image")));
			this.buttonItemFileOpen.ToolTipText = "Open Test";
			this.buttonItemFileOpen.Activate += new System.EventHandler(this.buttonItemFileOpen_Activate);
			// 
			// buttonItemFileSave
			// 
			this.buttonItemFileSave.Icon = ((System.Drawing.Icon)(resources.GetObject("buttonItemFileSave.Icon")));
			this.buttonItemFileSave.Image = ((System.Drawing.Image)(resources.GetObject("buttonItemFileSave.Image")));
			this.buttonItemFileSave.ToolTipText = "Save Test";
			this.buttonItemFileSave.Activate += new System.EventHandler(this.buttonItemFileSave_Activate);
			// 
			// buttonItemFilePreview
			// 
			this.buttonItemFilePreview.BeginGroup = true;
			this.buttonItemFilePreview.Icon = ((System.Drawing.Icon)(resources.GetObject("buttonItemFilePreview.Icon")));
			this.buttonItemFilePreview.Image = ((System.Drawing.Image)(resources.GetObject("buttonItemFilePreview.Image")));
			this.buttonItemFilePreview.Activate += new System.EventHandler(this.buttonItemEBuild_Activate);
			// 
			// buttonItemHelp
			// 
			this.buttonItemHelp.Icon = ((System.Drawing.Icon)(resources.GetObject("buttonItemHelp.Icon")));
			this.buttonItemHelp.ToolTipText = "Help";
			this.buttonItemHelp.Activate += new System.EventHandler(this.buttonItemHelp_Activate);
			// 
			// sandDockManager2
			// 
			this.sandDockManager2.OwnerForm = this;
			this.sandDockManager2.DockControlActivated += new TD.SandDock.DockControlEventHandler(this.sandDockManager2_DockControlActivated);
			// 
			// rightSandDock
			// 
			this.rightSandDock.Dock = System.Windows.Forms.DockStyle.Right;
			this.rightSandDock.Guid = new System.Guid("8da0f7b8-37ea-4b2a-9bc6-d561e34a3644");
			this.rightSandDock.LayoutSystem = new TD.SandDock.SplitLayoutSystem(250, 400);
			this.rightSandDock.Location = new System.Drawing.Point(1008, 54);
			this.rightSandDock.Manager = this.sandDockManager2;
			this.rightSandDock.Name = "rightSandDock";
			this.rightSandDock.Size = new System.Drawing.Size(0, 584);
			this.rightSandDock.TabIndex = 5;
			// 
			// bottomSandDock
			// 
			this.bottomSandDock.Dock = System.Windows.Forms.DockStyle.Bottom;
			this.bottomSandDock.Guid = new System.Guid("877ff79d-3e48-471d-a412-e7157330f8c7");
			this.bottomSandDock.LayoutSystem = new TD.SandDock.SplitLayoutSystem(250, 400);
			this.bottomSandDock.Location = new System.Drawing.Point(0, 638);
			this.bottomSandDock.Manager = this.sandDockManager2;
			this.bottomSandDock.Name = "bottomSandDock";
			this.bottomSandDock.Size = new System.Drawing.Size(1008, 0);
			this.bottomSandDock.TabIndex = 6;
			// 
			// topSandDock
			// 
			this.topSandDock.Dock = System.Windows.Forms.DockStyle.Top;
			this.topSandDock.Guid = new System.Guid("7c4e41db-3a54-44ed-a8d1-8c1634bf44e9");
			this.topSandDock.LayoutSystem = new TD.SandDock.SplitLayoutSystem(250, 400);
			this.topSandDock.Location = new System.Drawing.Point(0, 54);
			this.topSandDock.Manager = this.sandDockManager2;
			this.topSandDock.Name = "topSandDock";
			this.topSandDock.Size = new System.Drawing.Size(1008, 0);
			this.topSandDock.TabIndex = 7;
			// 
			// documentContainer1
			// 
			this.documentContainer1.Controls.Add(this.dockControlDetailInfo);
			this.documentContainer1.Controls.Add(this.dockControlExamTest);
			this.documentContainer1.Guid = new System.Guid("7d788abc-e6e7-4a55-ae16-39b20904faa6");
			this.documentContainer1.LayoutSystem = new TD.SandDock.SplitLayoutSystem(250, 400, System.Windows.Forms.Orientation.Horizontal, new TD.SandDock.LayoutSystemBase[] {
																																												   new TD.SandDock.DocumentLayoutSystem(752, 582, new TD.SandDock.DockControl[] {
																																																																	this.dockControlDetailInfo,
																																																																	this.dockControlExamTest}, this.dockControlDetailInfo)});
			this.documentContainer1.Location = new System.Drawing.Point(254, 54);
			this.documentContainer1.Manager = null;
			this.documentContainer1.Name = "documentContainer1";
			this.documentContainer1.Size = new System.Drawing.Size(754, 584);
			this.documentContainer1.TabIndex = 8;
			this.documentContainer1.ActiveDocumentChanged += new TD.SandDock.ActiveDocumentEventHandler(this.documentContainer1_ActiveDocumentChanged);
			// 
			// dockControlDetailInfo
			// 
			this.dockControlDetailInfo.Controls.Add(this.panel1);
			this.dockControlDetailInfo.Controls.Add(this.statusBar1);
			this.dockControlDetailInfo.Guid = new System.Guid("db50f7eb-1fc8-4ec8-86a2-043260668ae7");
			this.dockControlDetailInfo.Location = new System.Drawing.Point(3, 23);
			this.dockControlDetailInfo.Name = "dockControlDetailInfo";
			this.dockControlDetailInfo.Size = new System.Drawing.Size(748, 558);
			this.dockControlDetailInfo.TabIndex = 0;
			this.dockControlDetailInfo.Text = "Detail Infomations";
			// 
			// panel1
			// 
			this.panel1.Controls.Add(this.axWebBrowser1);
			this.panel1.Dock = System.Windows.Forms.DockStyle.Fill;
			this.panel1.Location = new System.Drawing.Point(0, 0);
			this.panel1.Name = "panel1";
			this.panel1.Size = new System.Drawing.Size(748, 536);
			this.panel1.TabIndex = 1;
			// 
			// axWebBrowser1
			// 
			this.axWebBrowser1.ContainingControl = this;
			this.axWebBrowser1.Dock = System.Windows.Forms.DockStyle.Fill;
			this.axWebBrowser1.Enabled = true;
			this.axWebBrowser1.Location = new System.Drawing.Point(0, 0);
			this.axWebBrowser1.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("axWebBrowser1.OcxState")));
			this.axWebBrowser1.Size = new System.Drawing.Size(748, 536);
			this.axWebBrowser1.TabIndex = 0;
			this.axWebBrowser1.NavigateComplete2 += new AxSHDocVw.DWebBrowserEvents2_NavigateComplete2EventHandler(this.axWebBrowser1_NavigateComplete2);
			// 
			// statusBar1
			// 
			this.statusBar1.Location = new System.Drawing.Point(0, 536);
			this.statusBar1.Name = "statusBar1";
			this.statusBar1.Panels.AddRange(new System.Windows.Forms.StatusBarPanel[] {
																						  this.statusBarPanel1,
																						  this.statusBarPanel2,
																						  this.statusBarPanel3});
			this.statusBar1.ShowPanels = true;
			this.statusBar1.Size = new System.Drawing.Size(748, 22);
			this.statusBar1.TabIndex = 0;
			this.statusBar1.Text = "statusBar1";
			// 
			// statusBarPanel1
			// 
			this.statusBarPanel1.AutoSize = System.Windows.Forms.StatusBarPanelAutoSize.Spring;
			this.statusBarPanel1.Width = 535;
			// 
			// statusBarPanel2
			// 
			this.statusBarPanel2.Width = 97;
			// 
			// dockControlExamTest
			// 
			this.dockControlExamTest.Controls.Add(this.panel2);
			this.dockControlExamTest.Controls.Add(this.statusBar3);
			this.dockControlExamTest.Guid = new System.Guid("f7abe3f7-a950-48d0-b6d3-3b95ae4a5a10");
			this.dockControlExamTest.Location = new System.Drawing.Point(3, 23);
			this.dockControlExamTest.Name = "dockControlExamTest";
			this.dockControlExamTest.Size = new System.Drawing.Size(748, 562);
			this.dockControlExamTest.TabIndex = 1;
			this.dockControlExamTest.Text = "ExamTest Question";
			// 
			// panel2
			// 
			this.panel2.Controls.Add(this.axWebBrowser2);
			this.panel2.Dock = System.Windows.Forms.DockStyle.Fill;
			this.panel2.Location = new System.Drawing.Point(0, 0);
			this.panel2.Name = "panel2";
			this.panel2.Size = new System.Drawing.Size(748, 540);
			this.panel2.TabIndex = 3;
			// 
			// axWebBrowser2
			// 
			this.axWebBrowser2.ContainingControl = this;
			this.axWebBrowser2.Dock = System.Windows.Forms.DockStyle.Fill;
			this.axWebBrowser2.Enabled = true;
			this.axWebBrowser2.Location = new System.Drawing.Point(0, 0);
			this.axWebBrowser2.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("axWebBrowser2.OcxState")));
			this.axWebBrowser2.Size = new System.Drawing.Size(748, 540);
			this.axWebBrowser2.TabIndex = 2;
			this.axWebBrowser2.NavigateComplete2 += new AxSHDocVw.DWebBrowserEvents2_NavigateComplete2EventHandler(this.axWebBrowser2_NavigateComplete2);
			// 
			// statusBar3
			// 
			this.statusBar3.Location = new System.Drawing.Point(0, 540);
			this.statusBar3.Name = "statusBar3";
			this.statusBar3.Panels.AddRange(new System.Windows.Forms.StatusBarPanel[] {
																						  this.statusBarPanel7,
																						  this.statusBarPanel8,
																						  this.statusBarPanel9});
			this.statusBar3.ShowPanels = true;
			this.statusBar3.Size = new System.Drawing.Size(748, 22);
			this.statusBar3.TabIndex = 2;
			this.statusBar3.Text = "statusBar3";
			// 
			// statusBarPanel7
			// 
			this.statusBarPanel7.AutoSize = System.Windows.Forms.StatusBarPanelAutoSize.Spring;
			this.statusBarPanel7.Width = 535;
			// 
			// statusBarPanel8
			// 
			this.statusBarPanel8.Width = 97;
			// 
			// dockControlExamTestTree
			// 
			this.dockControlExamTestTree.Controls.Add(this.treeViewExamTest);
			this.dockControlExamTestTree.Guid = new System.Guid("35ee7e65-df69-4124-8b31-28578e9e25ce");
			this.dockControlExamTestTree.Location = new System.Drawing.Point(0, 18);
			this.dockControlExamTestTree.Name = "dockControlExamTestTree";
			this.dockControlExamTestTree.Size = new System.Drawing.Size(250, 543);
			this.dockControlExamTestTree.TabIndex = 1;
			this.dockControlExamTestTree.Text = "ExamTest";
			this.dockControlExamTestTree.Click += new System.EventHandler(this.dockControlExamTestTree_Click);
			// 
			// treeViewExamTest
			// 
			this.treeViewExamTest.BackColor = System.Drawing.Color.FromArgb(((System.Byte)(214)), ((System.Byte)(228)), ((System.Byte)(244)));
			this.treeViewExamTest.Dock = System.Windows.Forms.DockStyle.Fill;
			this.treeViewExamTest.ImageIndex = -1;
			this.treeViewExamTest.Location = new System.Drawing.Point(0, 0);
			this.treeViewExamTest.Name = "treeViewExamTest";
			this.treeViewExamTest.SelectedImageIndex = -1;
			this.treeViewExamTest.Size = new System.Drawing.Size(250, 543);
			this.treeViewExamTest.TabIndex = 1;
			this.treeViewExamTest.Click += new System.EventHandler(this.treeViewExamTest_Click);
			this.treeViewExamTest.VisibleChanged += new System.EventHandler(this.treeViewExamTest_ChangeFocus);
			this.treeViewExamTest.DragOver += new System.Windows.Forms.DragEventHandler(this.treeViewExamTest_DragOver);
			this.treeViewExamTest.BeforeSelect += new System.Windows.Forms.TreeViewCancelEventHandler(this.treeViewExamTest_BeforeSelect);
			this.treeViewExamTest.Leave += new System.EventHandler(this.treeViewExamTest_ChangeFocus);
			this.treeViewExamTest.DragEnter += new System.Windows.Forms.DragEventHandler(this.treeViewExamTest_DragEnter);
			this.treeViewExamTest.ItemDrag += new System.Windows.Forms.ItemDragEventHandler(this.treeViewExamTest_ItemDrag);
			this.treeViewExamTest.DragLeave += new System.EventHandler(this.treeViewExamTest_DragLeave);
			this.treeViewExamTest.DragDrop += new System.Windows.Forms.DragEventHandler(this.treeViewExamTest_DragDrop);
			this.treeViewExamTest.Enter += new System.EventHandler(this.treeViewExamTest_ChangeFocus);
			// 
			// statusBar2
			// 
			this.statusBar2.Location = new System.Drawing.Point(0, 540);
			this.statusBar2.Name = "statusBar2";
			this.statusBar2.Panels.AddRange(new System.Windows.Forms.StatusBarPanel[] {
																						  this.statusBarPanel4,
																						  this.statusBarPanel5,
																						  this.statusBarPanel6});
			this.statusBar2.ShowPanels = true;
			this.statusBar2.Size = new System.Drawing.Size(748, 22);
			this.statusBar2.TabIndex = 1;
			this.statusBar2.Text = "statusBar2";
			// 
			// statusBarPanel4
			// 
			this.statusBarPanel4.AutoSize = System.Windows.Forms.StatusBarPanelAutoSize.Spring;
			this.statusBarPanel4.Width = 535;
			// 
			// statusBarPanel5
			// 
			this.statusBarPanel5.Width = 97;
			// 
			// oleDbConnection1
			// 
			this.oleDbConnection1.ConnectionString = @"Jet OLEDB:Global Partial Bulk Ops=2;Jet OLEDB:Registry Path=;Jet OLEDB:Database Locking Mode=1;Data Source=""E:\Work@Buss\etbTOEIC\dbTOEFL.mdb"";Mode=Share Deny None;Jet OLEDB:Engine Type=5;Provider=""Microsoft.Jet.OLEDB.4.0"";Jet OLEDB:System database=;Jet OLEDB:SFP=False;persist security info=False;Extended Properties=;Jet OLEDB:Compact Without Replica Repair=False;Jet OLEDB:Encrypt Database=False;Jet OLEDB:Create System Database=False;Jet OLEDB:Don't Copy Locale on Compact=False;User ID=Admin;Jet OLEDB:Global Bulk Transactions=1";
			// 
			// dockControlQuestionTree
			// 
			this.dockControlQuestionTree.BackColor = System.Drawing.SystemColors.Control;
			this.dockControlQuestionTree.Controls.Add(this.treeViewQuestion);
			this.dockControlQuestionTree.ForeColor = System.Drawing.SystemColors.ControlText;
			this.dockControlQuestionTree.Guid = new System.Guid("ac8d4faf-0026-4c4c-b2b0-83b9985e311d");
			this.dockControlQuestionTree.Location = new System.Drawing.Point(0, 18);
			this.dockControlQuestionTree.Name = "dockControlQuestionTree";
			this.dockControlQuestionTree.Size = new System.Drawing.Size(250, 543);
			this.dockControlQuestionTree.TabIndex = 0;
			this.dockControlQuestionTree.Text = "Questions";
			// 
			// treeViewQuestion
			// 
			this.treeViewQuestion.BackColor = System.Drawing.Color.FromArgb(((System.Byte)(255)), ((System.Byte)(255)), ((System.Byte)(192)));
			this.treeViewQuestion.Dock = System.Windows.Forms.DockStyle.Fill;
			this.treeViewQuestion.ImageIndex = -1;
			this.treeViewQuestion.Location = new System.Drawing.Point(0, 0);
			this.treeViewQuestion.Name = "treeViewQuestion";
			this.treeViewQuestion.SelectedImageIndex = -1;
			this.treeViewQuestion.Size = new System.Drawing.Size(250, 543);
			this.treeViewQuestion.TabIndex = 0;
			this.treeViewQuestion.Click += new System.EventHandler(this.treeViewQuestion_Click);
			this.treeViewQuestion.AfterCheck += new System.Windows.Forms.TreeViewEventHandler(this.treeViewQuestion_AfterCheck);
			this.treeViewQuestion.BeforeSelect += new System.Windows.Forms.TreeViewCancelEventHandler(this.treeViewQuestion_BeforeSelect);
			this.treeViewQuestion.Leave += new System.EventHandler(this.treeViewExamTest_ChangeFocus);
			this.treeViewQuestion.BeforeCheck += new System.Windows.Forms.TreeViewCancelEventHandler(this.treeViewQuestion_BeforeCheck);
			this.treeViewQuestion.Enter += new System.EventHandler(this.treeViewExamTest_ChangeFocus);
			// 
			// leftSandDock
			// 
			this.leftSandDock.Controls.Add(this.dockControlQuestionTree);
			this.leftSandDock.Controls.Add(this.dockControlExamTestTree);
			this.leftSandDock.Dock = System.Windows.Forms.DockStyle.Left;
			this.leftSandDock.Guid = new System.Guid("48ca87b0-92f3-438c-bbcf-dca38dc4a5e0");
			this.leftSandDock.LayoutSystem = new TD.SandDock.SplitLayoutSystem(250, 400, System.Windows.Forms.Orientation.Horizontal, new TD.SandDock.LayoutSystemBase[] {
																																											 new TD.SandDock.ControlLayoutSystem(250, 584, new TD.SandDock.DockControl[] {
																																																															 this.dockControlQuestionTree,
																																																															 this.dockControlExamTestTree}, this.dockControlQuestionTree)});
			this.leftSandDock.Location = new System.Drawing.Point(0, 54);
			this.leftSandDock.Manager = this.sandDockManager2;
			this.leftSandDock.Name = "leftSandDock";
			this.leftSandDock.Size = new System.Drawing.Size(254, 584);
			this.leftSandDock.TabIndex = 4;
			// 
			// FormMain
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(6, 16);
			this.ClientSize = new System.Drawing.Size(1008, 638);
			this.Controls.Add(this.documentContainer1);
			this.Controls.Add(this.leftSandDock);
			this.Controls.Add(this.rightSandDock);
			this.Controls.Add(this.bottomSandDock);
			this.Controls.Add(this.topSandDock);
			this.Controls.Add(this.leftSandBarDock);
			this.Controls.Add(this.rightSandBarDock);
			this.Controls.Add(this.bottomSandBarDock);
			this.Controls.Add(this.topSandBarDock);
			this.Font = new System.Drawing.Font("Tahoma", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
			this.Name = "FormMain";
			this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
			this.Text = "etbTOEIC";
			this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
			this.Closing += new System.ComponentModel.CancelEventHandler(this.FormMain_Closing);
			this.Load += new System.EventHandler(this.FormMain_Load);
			this.topSandBarDock.ResumeLayout(false);
			this.documentContainer1.ResumeLayout(false);
			this.dockControlDetailInfo.ResumeLayout(false);
			this.panel1.ResumeLayout(false);
			((System.ComponentModel.ISupportInitialize)(this.axWebBrowser1)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.statusBarPanel1)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.statusBarPanel2)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.statusBarPanel3)).EndInit();
			this.dockControlExamTest.ResumeLayout(false);
			this.panel2.ResumeLayout(false);
			((System.ComponentModel.ISupportInitialize)(this.axWebBrowser2)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.statusBarPanel7)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.statusBarPanel8)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.statusBarPanel9)).EndInit();
			this.dockControlExamTestTree.ResumeLayout(false);
			((System.ComponentModel.ISupportInitialize)(this.statusBarPanel4)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.statusBarPanel5)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.statusBarPanel6)).EndInit();
			this.dockControlQuestionTree.ResumeLayout(false);
			this.leftSandDock.ResumeLayout(false);
			this.ResumeLayout(false);

		}
		#endregion

		/// <summary>
		/// The main entry point for the application.
		/// </summary>
		[STAThread]
		static void Main() 
		{
			Application.Run(new FormLogin());
		}
		#region /* Cac su kien lien quan den he thong */

		private void FormMain_Load(object sender, System.EventArgs e)
		{
			this.WindowState = FormWindowState.Minimized;
			Splasher.Status = "Loading data.... Please wait";
			Splasher.Show();
			if (File.Exists(Environment.CurrentDirectory+ "\\etbTOEIC.ini"))
				LoadSettings(Environment.CurrentDirectory+ "\\etbTOEIC.ini");
			
			DB2MainForm.LoadGlobalInfo(ref Direction1A, ref Direction1B, ref Direction1C, ref Direction1D, ref Direction2A, ref Direction2B, ref Direction3, ref TheEnd1A, ref TheEnd1B, ref TheEnd1C, ref TheEnd1D, ref TheEnd2A, ref TheEnd2B, ref TheEnd3);
			DB2MainForm.LoadDB2Tree(treeViewQuestion);
		//	DB2MainForm.LoadTestDB2Tree(treeViewExamTest);

			toolBarExamTest_SetStatus();
			
			object o = null;
			axWebBrowser1.Navigate(Environment.CurrentDirectory+ "\\Reports\\Intro.htm",ref o,ref o,ref o,ref o);
			axWebBrowser1.Refresh();

			axWebBrowser2_Reload("", true);

			IsAutoCheck = true;
			DB2MainForm.MapCheckedNodeOnTrees(treeViewExamTest);
			IsAutoCheck = false;
			Splasher.Close();
			this.WindowState = FormWindowState.Maximized;
			this.Text += " - " + DB2MainForm.ExamCode;
		}
		private void FormMain_Closing(object sender, System.ComponentModel.CancelEventArgs e)
		{
			SaveSettings(Environment.CurrentDirectory+ "\\etbTOEIC.ini");
			if (RequestSaveChanged() == DialogResult.Cancel)
			{
				// Cancel the Closing event from closing the form.
				e.Cancel = true;
				return;
			}
			Application.Exit();
		}
		private void menuButtonItemChangePass_Activate(object sender, System.EventArgs e)
		{
			FormChangePassword frm = new FormChangePassword();
			frm.Show();
		}

		private void menuButtonItemLogOut_Activate(object sender, System.EventArgs e)
		{
			this.Hide();
			DB2MainForm.stCurrentUser = "";
			FormLogin frm = new FormLogin();
			frm.Show();
			this.Close();
			
		}

		private void menuButtonItemDelTest_Activate(object sender, System.EventArgs e)
		{
			FormDeleteTest frm = new FormDeleteTest();
			frm.Show();
		}

		private void menuButtonItemEditBook_Activate(object sender, System.EventArgs e)
		{
			FormEditBook frm = new FormEditBook();
			frm.Show();
		}

		private void menuButtonItemAddBook_Activate(object sender, System.EventArgs e)
		{
			FormAddBook frm = new FormAddBook();
			frm.Show();
		}

		private void menuButtonItemConfig_Activate(object sender, System.EventArgs e)
		{
			FormConfig frm = new FormConfig();
			frm.Show();
		}
		#endregion

		#region /* Load / Save setting o dang INI file. */
		public void LoadSettings(string config_file)
		{
			Ini iniConfig = new Ini(config_file);

			if (menuButtonItemDetailInfomations.Checked.ToString() != (string)iniConfig.GetValue(@"Settings", @"ActivedPanel",@""))
				documentContainer1.Documents[0].Activate();
			
			ChangeExamTestBrowser(Convert.ToInt32((string)iniConfig.GetValue(@"Settings", @"ActivedWindow", @"")), false);

			string sNumQues = (string)iniConfig.GetValue(@"ExamTest", @"NumberQuestions",@"");
			int k = 0;
			foreach (string s in sNumQues.Split(",".ToCharArray()))
			{
				nNumberOfQuesDef[k++] = Convert.ToInt32(s);
				if (k >= 7)
					break;
			}
			// report
			iniConfig.GetValue(@"Reports", @"School",  DB2MainForm.isDisplaySchool? "1" : "0");
			iniConfig.GetValue(@"Reports", @"Class",  DB2MainForm.isDisplayClass? "1" : "0");
			if(iniConfig.GetValue(@"Reports", @"ExamCode",  @"") == "1")
				DB2MainForm.isDisplayExamCode = true;
			else
				DB2MainForm.isDisplayExamCode = false;
			if(iniConfig.GetValue(@"Reports", @"Class",  @"") == "1")
				DB2MainForm.isDisplayClass = true;
			else
				DB2MainForm.isDisplayClass = false;

			if(iniConfig.GetValue(@"Reports", @"School",  @"") == "1")
				DB2MainForm.isDisplaySchool = true;
			else
				DB2MainForm.isDisplaySchool = false;

			DB2MainForm.stReportHeader = iniConfig.GetValue(@"Reports", @"Header", @"");
			DB2MainForm.stReportFooter = iniConfig.GetValue(@"Reports", @"Footer", @"");
			DB2MainForm.stPageDirection = iniConfig.GetValue(@"Reports", @"Direction", @"");
		}

		public void SaveSettings(string config_file)
		{
			Ini iniConfig = new Ini(config_file);

			iniConfig.SetValue(@"Settings", @"ActivedPanel", menuButtonItemDetailInfomations.Checked.ToString());
			iniConfig.SetValue(@"Settings", @"ActivedTree",  dockControlQuestionTree.Visible.ToString());
			string sActExamTest = (buttonItemETest.Checked? "0" : (buttonItemEAns.Checked? "1" : "2"));
			iniConfig.SetValue(@"Settings", @"ActivedWindow",  sActExamTest);
			iniConfig.SetValue(@"Reports", @"School",  DB2MainForm.isDisplaySchool? "1" : "0");
			iniConfig.SetValue(@"Reports", @"Class",  DB2MainForm.isDisplayClass? "1" : "0");
			iniConfig.SetValue(@"Reports", @"ExamCode",  DB2MainForm.isDisplayExamCode? "1" : "0");
			iniConfig.SetValue(@"Reports", @"Header",  DB2MainForm.stReportHeader);
			iniConfig.SetValue(@"Reports", @"Footer",  DB2MainForm.stReportFooter);
			iniConfig.SetValue(@"Reports", @"Direction",  DB2MainForm.stPageDirection);
		}
		#endregion

		#region /* Xu ly menu, toolbar File : NEW, OPEN, SAVE */
		private DialogResult RequestSaveChanged()
		{
			if (IsModifiedTest)
			{
				DialogResult ret = MessageBox.Show(this, "The data in the Test has changed.\n"+
					"Do you want to save the changes?", 
					"etbTOEIC", 
					MessageBoxButtons.YesNoCancel, 
					MessageBoxIcon.Warning);
				if (ret == DialogResult.OK)
				{
					SaveExamTest();
				}
				return ret;
			}
			return DialogResult.OK;
		}
		void SaveExamTest()
		{
			long ExamID = DB2MainForm.TestID;
			ExamCode = DB2MainForm.ExamCode;
			if(ExamCode == "Untitle")
			{
				FormSaveTest frm = new FormSaveTest();
				if(frm.ShowDialog() == DialogResult.OK)
				{
					DB2MainForm.InsertTest(Direction1A, Direction1B, Direction1C, Direction1D, Direction2A, Direction2B, Direction3, TheEnd1A, TheEnd1B, TheEnd1C, TheEnd1D, TheEnd2A, TheEnd2B, TheEnd3);
				}

			}
			else
				DB2MainForm.UpdateTest(ExamID,Direction1A, Direction1B, Direction1C, Direction1D, Direction2A, Direction2B, Direction3, TheEnd1A, TheEnd1B, TheEnd1C, TheEnd1D, TheEnd2A, TheEnd2B, TheEnd3);
			IsModifiedTest = false;
		}

		private void buttonItemFileNew_Activate(object sender, System.EventArgs e)
		{
			if (RequestSaveChanged() == DialogResult.Cancel)
				return;

			FormMakeNewTest frmNew = new FormMakeNewTest();
			frmNew.ShowDialog();
			if (frmNew.resShow != DialogResult.OK)
				return;
			DB2MainForm.ExamCode = "Untitle";
			int index = this.Text.IndexOf("-");
			if(index != -1)
				this.Text = this.Text.Substring(0,index + 1) + DB2MainForm.ExamCode;
			TestGenerate.TempTestGenerate(frmNew.nNumberOfQuesDef, frmNew.sWhereClauses);
			DB2MainForm.LoadTestDB2Tree(treeViewExamTest);
			IsAutoCheck = true;
			DB2MainForm.ResetTreeViewQues(treeViewQuestion);
			DB2MainForm.MapCheckedNodeOnTrees(treeViewExamTest);
			IsAutoCheck = false;
			IsModifiedTest = true;
			IsUpdatedView = false;
			axWebBrowser2_ReloadAll();
		}
		private void buttonItemFileOpen_Activate(object sender, System.EventArgs e)
		{
			if (RequestSaveChanged() == DialogResult.Cancel)
				return;

			FormOpenTest frmOpen = new FormOpenTest();
			if(frmOpen.ShowDialog() == DialogResult.OK)
			{
				DB2MainForm.LoadTestDB2Tree(treeViewExamTest);
				DB2MainForm.LoadTestInfo();
				IsAutoCheck = true;
				DB2MainForm.ResetTreeViewQues(treeViewQuestion);
				DB2MainForm.MapCheckedNodeOnTrees(treeViewExamTest);
				IsAutoCheck = false;
				this.Text = "etbTOEIC - " + DB2MainForm.ExamCode;
				axWebBrowser2_ReloadAll();
			}		
		}

		private void buttonItemFileSave_Activate(object sender, System.EventArgs e)
		{
			SaveExamTest();
		}

		private void menuButtonItemFileSaveAs_Activate(object sender, System.EventArgs e)
		{
			FormSaveTest frmSave = new FormSaveTest();
			if (frmSave.ShowDialog() == DialogResult.OK)
			{
				DB2MainForm.InsertTest(Direction1A, Direction1B, Direction1C, Direction1D, Direction2A, Direction2B, Direction3, TheEnd1A, TheEnd1B, TheEnd1C, TheEnd1D, TheEnd2A, TheEnd2B, TheEnd3);
			}
			IsModifiedTest = false;
		}

		private void menuButtonItemFileExit_Activate(object sender, System.EventArgs e)
		{
			this.Close();
			this.Dispose();
		}

		#endregion

		#region /* Xu ly su kien lien quan den SandDock */
		private void documentContainer1_ActiveDocumentChanged(object sender, TD.SandDock.ActiveDocumentEventArgs e)
		{
			menuButtonItemDetailInfomations.Checked = (((TD.SandDock.DocumentContainer )sender).ActiveDocument.Text == dockControlDetailInfo.Text);
			menuButtonItemExamTestDetail.Checked = !menuButtonItemDetailInfomations.Checked;
		}
		private void sandDockManager2_DockControlActivated(object sender, TD.SandDock.DockControlEventArgs e)
		{
		//	toolBarExamTest_SetStatus( );

			if (!IsUpdatedView && menuButtonItemExamTestTreeView.Checked)
				axWebBrowser2_Reload("", true);
		
		}
		private void dockControlExamTestTree_Click(object sender, System.EventArgs e)
		{
			toolBarExamTest_SetStatus( );
		}
		#endregion

		#region /* Xu ly menu, toolbar View : TOOLBAR, TREEVIEW, DOCVIEW */
		private void SetQuestionInfoStatusControl(string Type)
		{
			if (Type == "S")
			{
				buttonItemTAdd.Enabled = buttonItemTDel.Enabled = buttonItemTEdit.Enabled = buttonItemTPlay.Enabled = false;
				buttonItemQAdd.Enabled = buttonItemQDel.Enabled = buttonItemQEdit.Enabled = buttonItemQPlay.Enabled = false;
				buttonItemTAdd.Enabled = true;
			}
			else if (Type == "T")
			{
				buttonItemTAdd.Enabled = buttonItemTDel.Enabled = buttonItemTEdit.Enabled = buttonItemTPlay.Enabled = true;
				buttonItemQAdd.Enabled = buttonItemQDel.Enabled = buttonItemQEdit.Enabled = buttonItemQPlay.Enabled = false;
				buttonItemTAdd.Enabled = false;
				buttonItemQAdd.Enabled = true;
			}
			else if (Type == "Q")
			{
				buttonItemTAdd.Enabled = buttonItemTDel.Enabled = buttonItemTEdit.Enabled = buttonItemTPlay.Enabled = false;
				buttonItemQAdd.Enabled = buttonItemQDel.Enabled = buttonItemQEdit.Enabled = buttonItemQPlay.Enabled = true;
				buttonItemTPlay.Enabled = true;
				buttonItemQAdd.Enabled = false;
			}
		}
		private void menuBarItemView_BeforePopup(object sender, TD.SandBar.MenuPopupEventArgs e)
		{
			menuButtonItemStandardToolbar.Checked = toolBarStandard.Visible;
			menuButtonItemExamTestToolbar.Checked = toolBarExamTest.Visible;
			menuButtonItemQuestionToolbar.Checked = toolBarTopicQues.Visible;
			menuButtonItemQuestionsTreeView.Checked = dockControlQuestionTree.Visible;
			menuButtonItemExamTestTreeView.Checked = dockControlExamTestTree.Visible;
		}

		private void menuButtonItemStandardToolbar_Activate(object sender, System.EventArgs e)
		{
			toolBarStandard.Visible = !toolBarStandard.Visible;
		}

		private void menuButtonItemExamTestToolbar_Activate(object sender, System.EventArgs e)
		{
			toolBarExamTest.Visible = !toolBarExamTest.Visible;
		}

		private void menuButtonItemQuestionToolbar_Activate(object sender, System.EventArgs e)
		{
			toolBarTopicQues.Visible = !toolBarTopicQues.Visible;
		}

		private void menuButtonItemDetailInfomations_Activate(object sender, System.EventArgs e)
		{
			if (!menuButtonItemDetailInfomations.Checked)
				documentContainer1.Documents[0].Activate();
			menuButtonItemDetailInfomations.Checked = true;
			menuButtonItemExamTestDetail.Checked = false;
		}

		private void menuButtonItemExamTestDetail_Activate(object sender, System.EventArgs e)
		{
			if(documentContainer1.Documents[0].Visible)
				return;
			documentContainer1.Documents[0].Activate();
			menuButtonItemExamTestDetail.Checked = true;
			menuButtonItemDetailInfomations.Checked = false;
		}

		private void menuButtonItemQuestionsTreeView_Activate(object sender, System.EventArgs e)
		{
			
			if(sandDockManager2.GetDockControls()[0].Visible)
				return;
			sandDockManager2.GetDockControls()[0].Activate();
			menuButtonItemQuestionsTreeView.Checked = true;
		}

		private void menuButtonItemExamTestTreeView_Activate(object sender, System.EventArgs e)
		{
			//leftSandDock.Controls.Add(dockControlExamTestTree);
			if(sandDockManager2.GetDockControls()[1].Visible)
				return;
			sandDockManager2.GetDockControls()[1].Activate();
			menuButtonItemExamTestTreeView.Checked = true;
		}
		#endregion

		#region /* Xu ly menu, toolbar Help */
		private void menuButtonItemAbout_Activate(object sender, System.EventArgs e)
		{
			object o = null;
			axWebBrowser1.Navigate(Environment.CurrentDirectory+"\\Reports\\Intro.htm", ref o, ref o, ref o, ref o);
			axWebBrowser1.Refresh();
			if (!menuButtonItemDetailInfomations.Checked)
				documentContainer1.Documents[0].Activate();
			FormAbout frm = new FormAbout();
			frm.Show();
		}

		private void menuButtonItemHelp_Activate(object sender, System.EventArgs e)
		{
			//("iexplore.exe " + Application.StartupPath + "\\etbToeic-help-new.mht");
		}

		private void buttonItemHelp_Activate(object sender, System.EventArgs e)
		{
		
		}
		#endregion

		#region /* Xu ly tren Question TreeView */
		private bool IsAutoCheck = false;
		private void treeViewQuestion_BeforeCheck(object sender, System.Windows.Forms.TreeViewCancelEventArgs e)
		{
			if (IsAutoCheck)
				return;
			
			TreeNode node = (TreeNode)e.Node;
			if (node.Tag.ToString().StartsWith("S"))
				e.Cancel = true;			
			else if(node.Tag.ToString().StartsWith("T"))
			{
				long ID = Convert.ToInt64(node.Parent.Tag.ToString().Substring(1));
				if (ID != 4 && ID != 7)
					e.Cancel = true;
			}
		}
		private void treeViewQuestion_AfterCheck(object sender, System.Windows.Forms.TreeViewEventArgs e)
		{			
			if (IsAutoCheck)
				return;

			IsModifiedTest = true;
			IsAutoCheck = true;
			// Add or remove node in ExamTestTree
			if (((TreeNode)e.Node).Checked)
				DB2MainForm.CheckAndAddNode((TreeNode)e.Node, treeViewExamTest);
			else
				DB2MainForm.UnCheckAndRemoveNode((TreeNode)e.Node, treeViewExamTest);
			IsAutoCheck = false;
		}
		private void treeViewQuestion_BeforeSelect(object sender, System.Windows.Forms.TreeViewCancelEventArgs e)
		{
			treeViewQuestion_SetSelectedNode((TreeNode)e.Node);
			Stop();
		}
		private void treeViewQuestion_AfterSelect(object sender, System.Windows.Forms.TreeViewEventArgs e)
		{
			treeViewQuestion.CheckBoxes = IsModifyTestActive;		
		}
		private void treeViewQuestion_Click(object sender, System.EventArgs e)
		{
			if (treeViewQuestion.SelectedNode == null)
				return;
			treeViewQuestion_SetSelectedNode(treeViewQuestion.SelectedNode);
		}

		private void treeViewQuestion_SetSelectedNode(TreeNode node)
		{
			if (node == null)
				return;

			string Type = node.Tag.ToString().Substring(0, 1);
			long Id = Convert.ToInt64(node.Tag.ToString().Substring(1));
			long SID = 0, TID = 0, QID = 0;
			if (Type == "S")
				SID = Id;
			else if (Type == "T")
			{
				SID = Convert.ToInt64(node.Parent.Tag.ToString().Substring(1));
				TID = Id;
			}
			else if (Type == "Q")
			{	
				SID = Convert.ToInt64(node.Parent.Parent.Tag.ToString().Substring(1));
				TID = Convert.ToInt64(node.Parent.Tag.ToString().Substring(1));
				QID = Id;
			}

			SetQuestionInfoStatusControl( Type );

			try
			{
				object o = null;
				string stHtlmFile = webContent.MakeHTMLFileView(Type, SID, TID, QID);
				axWebBrowser1.Navigate(stHtlmFile, ref o, ref o, ref o, ref o);
				axWebBrowser1.Refresh();
			}
			catch(Exception)
			{
			}
			if (!menuButtonItemDetailInfomations.Checked)
				documentContainer1.Documents[0].Activate();
		}
		#endregion 

		#region /* Xu ly cac su kien ADD / EDIT / DEL /PLAY (Topic, Question) */
		private void buttonItemTAdd_Activate(object sender, System.EventArgs e)
		{
			TreeNode node = treeViewQuestion.SelectedNode;
			if (!node.Tag.ToString().StartsWith("S"))
			{
				MessageBox.Show("Seleted Node Fail");
				return;
			}

			long SectionID = Convert.ToInt64(node.Tag.ToString().Substring(1));			
			FormTopic frm = new FormTopic(SectionID, 0, node.Text); 
			
			if (frm.ShowDialog() == DialogResult.OK)
			{
				DB2MainForm.htID2TreeNode[node.Tag.ToString()] = node;
				DB2MainForm.LoadListTopics(node,SectionID,true);
			}
			
		}

		private void buttonItemTEdit_Activate(object sender, System.EventArgs e)
		{
			TreeNode node = treeViewQuestion.SelectedNode;
			if (!node.Tag.ToString().StartsWith("T"))
			{
				MessageBox.Show("Seleted Node Fail");
				return;
			}

			long SectionID = Convert.ToInt64(node.Parent.Tag.ToString().Substring(1));
			long TopicID = Convert.ToInt64(node.Tag.ToString().Substring(1));			
			FormTopic frm = new FormTopic(SectionID, TopicID, node.Parent.Text);
			
			if (frm.ShowDialog() == DialogResult.OK)
			{
				DB2MainForm.LoadListTopics(node.Parent,SectionID,true);
			}
			
		}

		private void buttonItemQAdd_Activate(object sender, System.EventArgs e)
		{
			TreeNode node = treeViewQuestion.SelectedNode;
			if (!node.Tag.ToString().StartsWith("T"))
			{
				MessageBox.Show("Seleted Node Fail");
				return;
			}

			long SectionID = Convert.ToInt64(node.Parent.Tag.ToString().Substring(1));
			long TopicID = Convert.ToInt64(node.Tag.ToString().Substring(1));			
			FormQuestion frm = new FormQuestion(SectionID, TopicID, 0, node.Parent.Text, node.Text); //add:0;Edit:1
			
			if (frm.ShowDialog() == DialogResult.OK)
			{
				//update treeview
				DB2MainForm.htID2TreeNode[node.Tag.ToString()] = node;
				DB2MainForm.LoadListQuestions(node, SectionID, TopicID, true);
			}
			
		}

		private void buttonItemQEdit_Activate(object sender, System.EventArgs e)
		{
			TreeNode node = treeViewQuestion.SelectedNode;
			if (!node.Tag.ToString().StartsWith("Q"))
			{
				MessageBox.Show("Seleted Node Fail");
				return;
			}

			long SectionID = Convert.ToInt64(node.Parent.Parent.Tag.ToString().Substring(1));
			long TopicID = Convert.ToInt64(node.Parent.Tag.ToString().Substring(1));			
			long QuestionID = Convert.ToInt64(node.Tag.ToString().Substring(1));			
			FormQuestion frm = new FormQuestion(SectionID, TopicID, QuestionID, node.Parent.Parent.Text,node.Parent.Text);
			
			if (frm.ShowDialog() == DialogResult.OK)
			{	
				DB2MainForm.LoadListQuestions(node.Parent, SectionID, TopicID, true);
			}
			
		}

		private void buttonItemTDel_Activate(object sender, System.EventArgs e)
		{
			DialogResult ret = MessageBox.Show(this, "Are you sure to delete this topic?", "etbTOEIC", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
			if (ret == DialogResult.No)
				return;

			TreeNode node = treeViewQuestion.SelectedNode;
			if(DB2MainForm.DeleteTopic(Convert.ToInt64(node.Tag.ToString().Substring(1))))
			{
				DB2MainForm.htID2TreeNode.Remove(node.Tag.ToString());
				DB2MainForm.LoadListTopics(node.Parent,Convert.ToInt64(node.Parent.Tag.ToString().Substring(1)),true);
			}
			else
			{
				MessageBox.Show("Topic is being used.");
			}
		}

		private void buttonItemQDel_Activate(object sender, System.EventArgs e)
		{
			DialogResult ret = MessageBox.Show(this, "Are you sure to delete this question?", "etbTOEIC", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
			if (ret == DialogResult.No)
				return;

			TreeNode node = treeViewQuestion.SelectedNode;
			

			if(DB2MainForm.DeleteQuestion(Convert.ToInt64(node.Tag.ToString().Substring(1))))
			{
				DB2MainForm.htID2TreeNode.Remove(node.Tag.ToString());
				long SectionID = Convert.ToInt64(node.Parent.Parent.Tag.ToString().Substring(1));
				long TopicID = Convert.ToInt64(node.Parent.Tag.ToString().Substring(1));
				
				DB2MainForm.LoadListQuestions(node.Parent,SectionID,TopicID,true);
			}
			else
			{
				MessageBox.Show("Delete fail. Current question is being used");
			}
		}

		private void buttonItemTPlay_Activate(object sender, System.EventArgs e)
		{
			if(treeViewExamTest.Focus())
			{
				TreeNode node = treeViewExamTest.SelectedNode;
				if(node != null && node.Tag.ToString().StartsWith("EQ"))
				{
					node = node.Parent;					
				}
				if(node != null && node.Tag.ToString().StartsWith("ET"))
				{
					string stSound  = MyDatabase.GetSound(Convert.ToInt64(node.Tag.ToString().Substring(2)), 0);
					if (stSound == "")
						return;
					stSound = Environment.CurrentDirectory + "\\Sounds\\" + stSound;
					Play(stSound);
				}
					

			}
			else if(treeViewQuestion.Focus())
			{
				TreeNode node = treeViewQuestion.SelectedNode;
				if(node != null && node.Tag.ToString().StartsWith("Q"))
				{
					node = node.Parent;			        					
				}
				if(node != null && node.Tag.ToString().StartsWith("T"))
				{
					string stSound  = MyDatabase.GetSound(Convert.ToInt64(node.Tag.ToString().Substring(1)), 0);
					if (stSound == "")
						return;
					stSound = Environment.CurrentDirectory + "\\Sounds\\" + stSound;
					Play(stSound);
				}
			}
		
		}

		private void buttonItemQPlay_Activate(object sender, System.EventArgs e)
		{
			if(treeViewExamTest.Focus())
			{
				TreeNode node = treeViewExamTest.SelectedNode;
				if(node != null && node.Tag.ToString().StartsWith("EQ"))
				{
					
					string stSound  = MyDatabase.GetSound(0, Convert.ToInt64(node.Tag.ToString().Substring(2)));
					if (stSound == "")
						return;
					stSound = Environment.CurrentDirectory + "\\Sounds\\" + stSound;
					Play(stSound);
				}

			}
			else if(treeViewQuestion.Focus())
			{
				TreeNode node = treeViewQuestion.SelectedNode;
				if(node != null && node.Tag.ToString().StartsWith("Q"))
				{
					
					string stSound  = MyDatabase.GetSound(0, Convert.ToInt64(node.Tag.ToString().Substring(1)));
					if (stSound == "")
						return;
					stSound = Environment.CurrentDirectory + "\\Sounds\\" + stSound;
					Play(stSound);
				}

			}
		
		}
		#region /* Play and Stop Sound */
		private void Play(string stFile)
		{
			try
			{
				if(m_objMediaControl != null)
				{
					Stop();
				}
						
				m_objFilterGraph = new FilgraphManager();
				m_objFilterGraph.RenderFile(stFile);

				m_objBasicAudio = m_objFilterGraph as IBasicAudio;
            
				m_objMediaEvent = m_objFilterGraph as IMediaEvent;

				m_objMediaEventEx = m_objFilterGraph as IMediaEventEx;
				m_objMediaEventEx.SetNotifyWindow((int) this.Handle,WM_GRAPHNOTIFY, 0);

				m_objMediaPosition = m_objFilterGraph as IMediaPosition;

				m_objMediaControl = m_objFilterGraph as IMediaControl;

				m_objMediaControl.Run();
			
			}
			catch(Exception)
			{

			}
		}
		private void Stop()
		{
			if (m_objMediaControl != null)
				m_objMediaControl.Stop();

			

			if (m_objMediaEventEx != null)
				m_objMediaEventEx.SetNotifyWindow(0, 0, 0);

			if (m_objVideoWindow != null)
			{
				m_objVideoWindow.Visible = 0;
				m_objVideoWindow.Owner = 0;
			}

			if (m_objMediaControl != null) m_objMediaControl = null;
			if (m_objMediaPosition != null) m_objMediaPosition = null;
			if (m_objMediaEventEx != null) m_objMediaEventEx = null;
			if (m_objMediaEvent != null) m_objMediaEvent = null;
			if (m_objVideoWindow != null) m_objVideoWindow = null;
			if (m_objBasicAudio != null) m_objBasicAudio = null;
			if (m_objFilterGraph != null) m_objFilterGraph = null;
		}
		protected override void WndProc( ref Message m)
		{
			if (m.Msg == WM_GRAPHNOTIFY)
			{
				int lEventCode;
				int lParam1, lParam2;

				while (true)
				{
					try
					{
						m_objMediaEventEx.GetEvent(out lEventCode, 
							out lParam1,
							out lParam2,
							0); 
 
						m_objMediaEventEx.FreeEventParams(lEventCode, lParam1, lParam2);

						if (lEventCode == EC_COMPLETE)
						{
							Stop();
							
						}
					} 
					catch (Exception)
					{
						break;
					}
				}
			}

			base.WndProc(ref m);
		}
#endregion
		#endregion

		#region /* Xu ly su kien lien quan den ExamTest */
		#region /* Xu ly tren ExamTest TreeView */
		private void treeViewExamTest_ChangeFocus(object sender, System.EventArgs e)
		{
			toolBarExamTest_SetStatus();
		}
		private void treeViewExamTest_BeforeSelect(object sender, System.Windows.Forms.TreeViewCancelEventArgs e)
		{
			treeViewExamTest_SetSelectedNode((TreeNode)e.Node);
			Stop();
		}

		private void treeViewExamTest_Click(object sender, System.EventArgs e)
		{
			//treeViewExamTest_SetSelectedNode(treeViewExamTest.SelectedNode);
		}

		private void treeViewExamTest_SetSelectedNode(TreeNode node)
		{
			if (node == null)
				return;

			string Type = node.Tag.ToString().Substring(0, 2);
			long Id = Convert.ToInt64(node.Tag.ToString().Substring(2));
			string sSubFlash = ((Type == "ES")? "Section_" : (Type == "ET")? "Topic_" : "Question_") + Id.ToString();

			axWebBrowser2_Reload(sSubFlash, false);
			
			if (!menuButtonItemExamTestDetail.Checked)
				documentContainer1.Documents[0].Activate();
		}

		#region /* Xu ly Drag / Drop cua caca TOPIC, QUES tren Cay cau hoi. */
		private TreeNode nodeDrag = null;
		private Point Position = new Point(0, 0);
		private void treeViewExamTest_ItemDrag(object sender, System.Windows.Forms.ItemDragEventArgs e)
		{
			nodeDrag = (TreeNode)e.Item;
			string strItem = e.Item.ToString();
			DoDragDrop(strItem, DragDropEffects.Copy |  DragDropEffects.Move);
		}

		private void treeViewExamTest_DragEnter(object sender, System.Windows.Forms.DragEventArgs e)
		{
			if (e.Data.GetDataPresent(DataFormats.Text)) 
				e.Effect = DragDropEffects.Move;
			else
				e.Effect = DragDropEffects.None;
		}

		private void treeViewExamTest_DragOver(object sender, System.Windows.Forms.DragEventArgs e)
		{
			Position = treeViewExamTest.PointToClient(new Point(e.X, e.Y));
			TreeNode node = this.treeViewExamTest.GetNodeAt(Position);
			if (node != null && node.Parent == this.nodeDrag.Parent )
				statusBarPanel7.Text = "Move to "+node.Text;
			else
				statusBarPanel7.Text = "";
		}

		private void treeViewExamTest_DragDrop(object sender, System.Windows.Forms.DragEventArgs e)
		{
			Position = treeViewExamTest.PointToClient(new Point(e.X, e.Y));
			TreeNode nodeDrop = this.treeViewExamTest.GetNodeAt(Position);
			if (nodeDrop != null && nodeDrop.Parent == this.nodeDrag.Parent )
			{
				TreeNode nodeNew = this.nodeDrag;
				nodeDrop.Parent.Nodes.Remove(this.nodeDrag);
				nodeDrop.Parent.Nodes.Insert(nodeDrop.Index, nodeNew);
			}
			statusBarPanel7.Text = "";
		}
		private void treeViewExamTest_DragLeave(object sender, System.EventArgs e)
		{
			statusBarPanel7.Text = "";
		}
		#endregion
		#endregion

		#region /* Xu ly su kien MOVE UP,DOWN, REMOVE ... INFO cua ExamTest */
		private void toolBarExamTest_SetStatus()
		{
			bool isTreeVisible = treeViewExamTest.Focused && treeViewExamTest.Visible && (treeViewExamTest.SelectedNode!=null);

			buttonItemExamTestCanModify.Visible = IsModifyTestActive;
			buttonItemExamTestNoModify.Visible  = !IsModifyTestActive;
			
			buttonItemExamTestRefresh.Enabled = buttonItemEInfo.Enabled = menuButtonItemModifyExamTest.Checked = IsModifyTestActive;
			buttonItemMoveUp.Enabled = buttonItemMoveDown.Enabled = buttonItemRemoveItem.Enabled = (IsModifyTestActive && isTreeVisible);
			menuButtonItemMoveUp.Enabled = menuButtonItemMoveDown.Enabled = menuButtonItemRemoveItem.Enabled = (IsModifyTestActive && isTreeVisible);
			menuButtonItemModifyExamTest.Text = (IsModifyTestActive? "Un":"")+menuButtonItemModifyExamTest.Tag.ToString();
			menuButtonItemModifyExamTest.Checked = !IsModifyTestActive;
			
			treeViewExamTest.AllowDrop = IsModifyTestActive;
			if (treeViewQuestion.CheckBoxes != IsModifyTestActive) treeViewQuestion.CheckBoxes = IsModifyTestActive;
		}
		private void buttonItemExamTestModify_Change(object sender, System.EventArgs e)
		{
			IsModifyTestActive = !IsModifyTestActive;
			toolBarExamTest_SetStatus( );
			if(IsModifyTestActive)
			{
				IsAutoCheck = true;
				DB2MainForm.MapCheckedNodeOnTrees(treeViewExamTest);
				IsAutoCheck = false;
			}
		}
		private void buttonItemExamTestRefresh_Activate(object sender, System.EventArgs e)
		{
			DB2MainForm.ReOrderNodes(treeViewExamTest);
			DB2MainForm.TreeView2DB(treeViewExamTest);
			axWebBrowser2_Reload("", true);
		}
		private void buttonItemEInfo_Activate(object sender, System.EventArgs e)
		{
			FormProperties frmProperties = new FormProperties(treeViewExamTest);
			frmProperties.Show();
		}
		private void buttonItemMoveUp_Activate(object sender, System.EventArgs e)
		{
			if(IsModifyTestActive)
			{
				DB2MainForm.MoveUp(treeViewExamTest);
			}
		}
		private void buttonItemMoveDown_Activate(object sender, System.EventArgs e)
		{	
			if(IsModifyTestActive)
			{
				DB2MainForm.MoveDown(treeViewExamTest);
			}
		}
		private void buttonItemRemoveItem_Activate(object sender, System.EventArgs e)
		{
			if( IsModifyTestActive && treeViewExamTest.SelectedNode != null )
			{
				IsAutoCheck = true;
				DB2MainForm.DeleteQuestionFromTree(treeViewExamTest.SelectedNode, treeViewExamTest);
				IsAutoCheck = false;
			}

		}
		#endregion

		#region /* Xu ly su kien TEST, ANS, TAPE, SOUND, BUILD cua ExamTest */
		/* Thay doi trang thai the hien cua ExamTest Browser. */
		private void ChangeExamTestBrowser(int index, bool active)
		{
			switch (index)
			{
				case 0:
					dockControlExamTest.Text = buttonItemETest.ToolTipText;
					break;
				case 1:
					dockControlExamTest.Text = buttonItemEAns.ToolTipText;
					break;
				case 2:
					dockControlExamTest.Text = buttonItemETape.ToolTipText;
					break;
			}
			buttonItemETest.Checked = menuButtonItemETQuestion.Checked = index==0;
			buttonItemEAns.Checked  = menuButtonItemETAnswer.Checked = index==1;
			buttonItemETape.Checked = menuButtonItemETTape.Checked = index==2;
			
			axWebBrowser2_Reload("", false);

			if (!menuButtonItemExamTestDetail.Checked && active)
				documentContainer1.Documents[0].Activate();
		}
		private void menuButtonItemETWindow_Activate(object sender, System.EventArgs e)
		{
			if (sender.ToString() == "TD.SandBar.MenuButtonItem")
			{
				if (((TD.SandBar.MenuButtonItem)sender).Text.EndsWith("Question"))
					ChangeExamTestBrowser(0, true);
				else if (((TD.SandBar.MenuButtonItem)sender).Text.EndsWith("Answer Key"))
					ChangeExamTestBrowser(1, true);
				else
					ChangeExamTestBrowser(2, true);
			}
			else if (sender.ToString() == "TD.SandBar.ButtonItem")
			{
				if (((TD.SandBar.ButtonItem)sender).ToolTipText.EndsWith("Question"))
					ChangeExamTestBrowser(0, true);
				else if (((TD.SandBar.ButtonItem)sender).ToolTipText.EndsWith("Answer Key"))
					ChangeExamTestBrowser(1, true);
				else
					ChangeExamTestBrowser(2, true);
			}
		}
		private void buttonItemESound_Activate(object sender, System.EventArgs e)
		{
			if (RequestSaveChanged() == DialogResult.Cancel)
				return;

			frmMakeSoundTape frmSound = new frmMakeSoundTape(treeViewExamTest);
			frmSound.ShowDialog();
		}

		private void buttonItemEBuild_Activate(object sender, System.EventArgs e)
		{
			if (RequestSaveChanged() == DialogResult.Cancel)
				return;
			Splasher.Status = "Generating report.";
			Splasher.Show();
			FormBuildReport frmReport = new FormBuildReport();
			frmReport.Show();
			Splasher.Close();
		}
		#endregion 
		#endregion 

		#region /* Chan va chuyen huong su kien tren axWebBrowser */
		private void axWebBrowser1_NavigateComplete2(object sender, AxSHDocVw.DWebBrowserEvents2_NavigateComplete2Event e)
		{
			axWebBrowser_Links((string)e.uRL);
		}
		private void axWebBrowser2_NavigateComplete2(object sender, AxSHDocVw.DWebBrowserEvents2_NavigateComplete2Event e)
		{
			axWebBrowser_Links((string)e.uRL);
		}
		private void axWebBrowser_Links(string url)
		{
			try
			{
				if (url.IndexOf("#") > 0)
					url = url.Substring(url.IndexOf("#"));
			
				if ( url.StartsWith("#Section=") || url.StartsWith("#Topic=") || url.StartsWith("#Question="))
				{
					string sId = url.Substring(1,1) + url.Substring(url.IndexOf("=")+1);
					if (DB2MainForm.htID2TreeNode.Contains("E"+sId))
						treeViewExamTest.SelectedNode = (TreeNode)DB2MainForm.htID2TreeNode["E"+sId];
					if (DB2MainForm.htID2TreeNode.Contains(sId))
						treeViewQuestion.SelectedNode = (TreeNode)DB2MainForm.htID2TreeNode[sId];
					else
					{
						long SID = 0, TID = 0, QID = 0;
						MyDatabase.GetLinkIDRow(sId, ref SID, ref TID, ref QID);
						
						if (SID > 0 && TID > 0 && !DB2MainForm.htID2TreeNode.Contains("T"+TID.ToString()))
							DB2MainForm.LoadListTopics((TreeNode)DB2MainForm.htID2TreeNode["S"+SID.ToString()], SID, true);
						if (SID > 0 && TID > 0 && QID > 0 && !DB2MainForm.htID2TreeNode.Contains("Q"+QID.ToString()))
							DB2MainForm.LoadListQuestions((TreeNode)DB2MainForm.htID2TreeNode["T"+TID.ToString()], SID, TID, true);

						if (DB2MainForm.htID2TreeNode.Contains(sId))
							treeViewQuestion.SelectedNode = (TreeNode)DB2MainForm.htID2TreeNode[sId];
					}
					if (dockControlQuestionTree.Visible)
						treeViewQuestion.Focus();
					else if (dockControlExamTestTree.Visible)
						treeViewExamTest.Focus();
				}
				else if ( url.StartsWith("#Book="))
				{
					string sId = url.Substring(url.IndexOf("=")+1);
					object o = null;
					string stHtlmFile = webContent.MakeHTMLFileView("B", sId);
					axWebBrowser1.Navigate(stHtlmFile, ref o, ref o, ref o, ref o);
					axWebBrowser1.Refresh();
					treeViewQuestion.Focus();
				}
			}
			catch(Exception)
			{
			}
		}

		private void axWebBrowser2_Reload(string sSubFlash, bool renew)
		{
			try
			{
				string Type = (menuButtonItemETQuestion.Checked)? "ES": menuButtonItemETAnswer.Checked? "AS":"TS";
				if (sSubFlash.Length==0 && axWebBrowser2.LocationURL.IndexOf("#") > 0)
					sSubFlash = "#" + axWebBrowser2.LocationURL.Substring(axWebBrowser2.LocationURL.IndexOf("#")+1);
				else
					sSubFlash = "#" + sSubFlash;
				sSubFlash = (sSubFlash != "#Section=1")? sSubFlash : "";

				object o = null;
				string stHtlmFile = webContent.MakeHTMLEFileView(Type, renew);
				axWebBrowser2.Navigate(stHtlmFile + sSubFlash, ref o, ref o, ref o, ref o);
				//axWebBrowser2.Refresh();
					
				IsUpdatedView = true;
			}
			catch(Exception)
			{
			}
		}

		private void axWebBrowser2_ReloadAll()
		{
			try
			{
				webContent.MakeHTMLEFileView("ES", true);
				webContent.MakeHTMLEFileView("AS", true);
				webContent.MakeHTMLEFileView("TS", true);
				axWebBrowser2.Refresh();
			}
			catch(Exception)
			{
			}
		}
		
		#endregion 

		

		
	}
}
